May 09, 2024, 12:48:54 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


DIM

Started by GJ, December 24, 2006, 08:18:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GJ

Is there a way to assign an array using a variable ??

I used this in Ibasic Standard:


def a:int
' just set a=10, normally this value is read from within the program
a=10
def b$[a]: string
a=2
b$[a]="123"
openconsole
print b$[a]

'stop    --  when in Ibasic standard examining the variables, says array of 10 elements

DO
UNTIL INKEY$ <> ""
end


I like to determine first how many elements the array should be, then dimensioning it by using a variable.



Regards,

GJ





Ionic Wind Support Team

Emergence BASIC is a true compiler so array sizes need to be known at compile time.   You can use NEW to create an array of dynamic size.

Paul.
Ionic Wind Support Team

GJ

Thank you Paul for your very quick answer. I will have to modify some code then, no problem  ;)

GJ