我有一个循环:
While $n <18
$dq=IniRead("zck.ini","zck","x"&$n,"")
Select
case $n=1
$dx1=$dq
case $n=2
$dx2=$dq
#cs
........
#ce
EndSelect
$n=$n+1
WEnd
我的问题是:如果While $n <18的循环数很大的情况下,那不是select命令中的case行也很多?能不能简单到把我需要赋值的DX1-----DX17这些变量中的1----17用变量$n来代入?意思就是变量名中是否能代入变量???
修改后的代码为(读取预置的三组数据,每组共17个):
Func dqyz();读取预置
dim $dx[18]
dim $dy[18]
dim $s[18]
dim $dqn = 1
While $dqn < 18
$dx[$dqn] = IniRead("zck.ini", "zck", "dx" & $dqn, "")
$dy[$dqn] = IniRead("zck.ini", "zck", "dy" & $dqn, "")
$s[$dqn] = IniRead("zck.ini", "zck", "s" & $dqn, "")
$dqn = $dqn + 1
WEnd
EndFunc ;==>dqyz
[ 本帖最后由 ahphsautoit 于 2009-4-16 10:30 编辑 ] |