for loop & array

Get help using Construct 2

Post » Sun Jan 26, 2014 8:49 am

Hi all,

First of all must say I'm a beginner with Construct 2.
I come from other developing languages and I just can't do something as easy as setting an array values using a for loop.

How can I do this???

Dim x as integer
Dim intValue as integer
Dim intTotal as integer=10

for x=0 to intTotal
    Array[x]=intValue
    intValue=intValue+1
next

Thank you in advance,
B
4
Posts: 16
Reputation: 232

Post » Sun Jan 26, 2014 9:00 am

Create local/global variable, intTotal = 10

1) create an array
2) before you start for loop, array set size intTotal,1,1 (this will give you a 1 dimensional array of intTotal length.
3)
Condition:
-for 0 to (intTotal - 1)
Action:
-array, set at x. value = intValue

OR
1) create an array
2) before you start for loop, array set size 0,1,1 (this will give you a 1 dimensional array of 0 length.
3)
Condition:
-for 0 to (intTotal - 1)
Action:
-array, push end of x. value = intValue

Reference:
https://www.scirra.com/manual/108/arrayc4sp3r892014-01-26 09:01:17
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Sun Jan 26, 2014 10:00 pm

Thanks! It works
B
4
Posts: 16
Reputation: 232


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Ryan Kocourek, Yahoo [Bot] and 4 guests