QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: krovit on February 04, 2020, 05:20:40 am
-
Have patience, please...
I am seriously worried: could I have forgotten things I know I already know? Old age?
When sizing or resizing an array, you assign a space to the variables.
The space, at the beginning, is obviously empty (the variables are zeo or null).
Question: is there any way to know if any of the indexed variables has a value different from zeo or different from null?
-
Excuse me... of course my question refers to a possible alternative of a FOR-NEXT that scans the whole array
-
Sorry. I think a FOR.. NEXT loop would probably be your best way to check for the existence of non-zero values.
-
Hi krovit,
Here is my test:
i = 1
i = i + 1
i = 1
i = i + 1
i = 1
PRINT arr
(i
).x;
","; arr
(i
).y;
" ";
i = i + 1
i = 1
PRINT arr
(i
).x;
","; arr
(i
).y;
" ";
i = i + 1
EDIT for strings, well today I couldn't get garbage in unassigned values, 0's or nothings here but as I recall this is not always the case.
-
Thank you bplus!