0 Favourites

Function plugin's return action ends the function?

  • 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.

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)