Local variables within function

Discussion and feedback on Construct 2

Post » Fri Jul 18, 2014 2:00 pm

So I have been doing some development outside of Construct 2 and decided to come back. One thing that I do a lot is set up a variable within the scope of a function. I know I can just set up a global variable and work around this but I feel it would be easier to just set up local variables within functions. I think enough programmers do this to think about adding it to the to do list.
B
71
S
11
G
6
Posts: 375
Reputation: 8,486

Post » Fri Jul 18, 2014 2:28 pm

You can have a Local variable under a function definition, then it will be accessible from function sub-events (from the var definition onwards) and not from elsewhere. What did you have in mind?
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Jul 18, 2014 6:53 pm

create an empty sub event in the function.

then right click to create a local variable
B
43
S
11
G
4
Posts: 428
Reputation: 7,454


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests