AmiBlitz³
Question about reading Data? - Druckversion

+- AmiBlitz³ (https://www.amiblitz.de/community)
+-- Forum: AmiBlitz³ (https://www.amiblitz.de/community/forum-3.html)
+--- Forum: Questions & Answers (https://www.amiblitz.de/community/forum-7.html)
+--- Thema: Question about reading Data? (/thread-78.html)



Question about reading Data? - A500 - 14.03.2014

It is a very simple question but I am unable to solve the problem. I have a data that holds these values:

inside a While AddItem I have a read dat, but it only is reading -1.


Code:
While AddItem(Objects())
   Restore MyValues
   Read dat(iCounter)
   NPrint dat(iCounter)
   If dat(iCounter)=-1 Then GoTo Skipping
.....
Skipping:
   iCounter=iCounter+1
Wend


MyValues:
Data -1,-1,-1,-1,16

When I run the program instead of getting -1,-1,-1,-1, 16...I am getting -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1.....all the way up to 59th -1. It is inside a loop that holds 59 items. I am Ok with the rest of them being -1...what I am not going that there is no 16 in the list. It is as if...and it is true...it is as if...it is reading only the first value from Data which is -1...then repeating that same first value 59 times.


Re: Question about reading Data? - Der Wanderer - 14.03.2014

Because you "restore" to MyValues within the loop.


Re: Question about reading Data? - A500 - 14.03.2014

Thanks Big Grin