Function plugin's return action ends the function?

Get help using Construct 2

Post » Fri Jul 12, 2013 1:38 am

Hello everyone,

I know that in the the Python programming language once you use a return statement the function ends right there. Does this also happen with construct? I am talking about the Function object, once I use it's return action will the function end after that? What happens if I use multiple return actions, will only the last return be actually returned?

I have read the entire manual before and I just rechecked the Function object's section, nothing on this on there.

Thanks for any help.
B
11
S
4
G
2
Posts: 20
Reputation: 1,412

Post » Fri Jul 12, 2013 2:04 am

I'm pretty sure it doesn't end the function, it just sets the return value. I don't have access to C2 atm but you can test it by making a simple function with two return actions. Make the first return 1 and the second 2. Then call the function from an expression. If the action stops the function you'll get 1 otherwise you'll get 2. R0J0hound2013-07-12 02:05:40
B
85
S
27
G
85
Posts: 5,070
Reputation: 57,874

Post » Fri Jul 12, 2013 6:45 am

Great suggestion Sir R0J0hound! I just tried it and got 2. For anyone else that is wondering, the return action does NOT end the function. The value of the Function.ReturnValue expression will be whatever your last return was.
B
11
S
4
G
2
Posts: 20
Reputation: 1,412


Return to How do I....?

Who is online

Users browsing this forum: LaurenceBedford, oddreal, SondeepH, tarek2 and 4 guests