

#演示【静态数组】的排序

#预处理函数: 可配置 MKScript 脚本加载后自动运行
#mkscript_config_auto_start()


#静态数组定义
string fen[5] = {"a", "aa", "bb", "ccc", "ddd"}

#修改数组的值
fen[0] = "a"
fen[1] = "aaa"
fen[2] = "aa"
fen[3] = "aaaa"
fen[4] = "aaaaa"


int m,n

#临时变量
string t

#排序
for m = 0 to 4
   
    for n = m + 1 to 4

        if len(fen[m]) > len(fen[n])

            t = fen[m]

            fen[m] = fen[n]

            fen[n] = t

        endif        

    next

next


for int i = 0 to 4

    println("fen[" + i + "]: " + fen[i])
    
next
