Jump to content

Recommended Posts

Posted

If I have nested functions:

Function someFunction()
      someOtherFunction()
      some_stuff..
EndFunction

Function someOtherFunction()
      some_more_stuff..
      Return
EndFunction

will the Return statement exit out of someFunction() as well as someOtherFunction() or will someFunction still run 'some_stuff'?

 

diziet

Posted

Return tells papyrus to exit the current function and go back to where it was. In your example, the papyrus thread running someOtherFunction() will exit that function and go back to someFunction(). Note, putting return at the end of a function is pointless. Its purpose is to exit a function or event early if criteria are not met.

Posted

IsharaMeradin Is correct. I would add that return is also used to get a value back from a function.

 

Example:

 

Function SomeFunction()
    Int TestInt = IntFunction() ;TestInt is 10
EndFunction 


Int Function IntFunction() 
    Return 10 
EndFunction
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...