THE FOR statement
Robban
Posts: 124
Hi!
I was wondering why i only get the first value of a value...
Like
value var word
i var byte
Value=192
for i=1 to 3
debug dec value(i),cr
next
when i start this program i only get..
1
0
0
i want to get
1
9
2
/why?
Regards
Robban
I was wondering why i only get the first value of a value...
Like
value var word
i var byte
Value=192
for i=1 to 3
debug dec value(i),cr
next
when i start this program i only get..
1
0
0
i want to get
1
9
2
/why?
Regards
Robban
Comments
You're trying to read an array which hasn't been properly defined.
However, the following bit of code from the HELP file will do what you want:
Main:
value = 9742
DEBUG ? value DIG 2 ' Show digit 2 (7)
FOR idx = 0 TO 4
DEBUG ? value DIG idx ' Show digits 0 - 4 of 9742
NEXT
END
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·