Code: Select all
var d := dictionary;
for i := 1 to 3
d[i] := "test";
endfor
print(d);
PS: core099
Moderator: POL Developer
Code: Select all
var d := dictionary;
for i := 1 to 3
d[i] := "test";
endfor
print(d);
Code: Select all
use os;
program TestScript()
var d := dictionary;
for i := 1 to 3
d[i] := "test";
Print("i="+i+" Val="+d[i]);
endfor
print(d);
return 1;
endprogram
-------------------
i=1 Val=test
i=2 Val=test
i=3 Val=test
dict{ 4 -> "test" }
Code: Select all
use os;
program TestScript()
var d := dictionary;
for i := 1 to 4
d[Hex(i)] := "test";
Print("i="+i+" Val="+d[Hex(i)]);
endfor
print(d);
return 1;
endprogram
-------------------
i=1 Val=test
i=2 Val=test
i=3 Val=test
i=4 Val=test
dict{ "0x1" -> "test", "0x2" -> "test", "0x3" -> "test", "0x4" -> "test" }
Code: Select all
use os;
program TestScript()
var d := dictionary;
for i:=1 to 4
d[CStr(i)] := "test";
Print("i="+i+" Val="+d[CStr(i)]);
endfor
print(d);
return 1;
endprogram
-----------------------
i=1 Val=test
i=2 Val=test
i=3 Val=test
i=4 Val=test
dict{ "1" -> "test", "2" -> "test", "3" -> "test", "4" -> "test" }
Code: Select all
use os;
program TestScript()
var d := dictionary;
var i;
for ( i := 1; i <= 4; i += 1 )
d[i] := "test";
Print("i="+i+" Val="+d[i]);
endfor
print(d);
return 1;
endprogram
----------------
i=1 Val=test
i=2 Val=test
i=3 Val=test
i=4 Val=test
dict{ 1 -> "test", 2 -> "test", 3 -> "test", 4 -> "test" }
Code: Select all
var t;
for i := t to 4
// pass
endfor