Design forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Refer to parameters within if statement

Anonymous
Not applicable
Hi!

As a newbie in GDL, I can't get how to get together string and numbers.
My case:

I have parameters: a1, a2, a3, a4, a5 etc... with the same values

I want to create an if statement with all of the parameters, but it doesn't work, I can not create a right script to describe the parameters
for i=1 to 10
if a+str(i) = something then
....build something....
else
....build something else....
endif
next i

if I want to loop with values, it works, but I don't get why, and how to
for i=1 to 10
value "a"+str(i,1,0) param1, param2
next i
can somebody explane it to me?
1 REPLY 1

Bruce
Booster
You can't concatenate variable names like this in GDL (although you can in other languages). To do the same thing, use an array. These are declared using the DIM statement e.g. DIM arrayName[]
Bruce Walker
http://www.brucepwalker.com
https://www.mindmeister.com/65450406

-- since v8.1 --
AC22 6025 INT Full | macOS Mojave 10 | 3.2 GHz Intel Xeon W | 32 Gb RAM | Radeon Pro Vega 56 8 Gb

Didn't find the answer? Start a new discussion

Labels

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!