Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Are STATIC arrays supported in XBasic?

arrays static supported xbasic
0
Posted

Are STATIC arrays supported in XBasic?

0

I have zillions of static arrays all over the place! The easiest and best way to dimension and initialize them is like the following: FUNCTION Test () STATIC USHORT array[] IFZ array[] THEN GOSUB Initialize ‘ ‘ body of the function ‘ RETURN ‘ ‘ ***** Initialize ***** ‘ SUB Initialize DIM array[65535] FOR i = 0 TO 65535 array[i] = i NEXT i END SUB END FUNCTION This works correctly because XBasic arrays are always empty until they are DIMensioned. So IFZ array[] THEN is all it takes. The dimensions [and contents] of static arrays never change unless code in the function does it.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123