Skip to content

Features Return

Kameron Brooks edited this page Aug 17, 2019 · 1 revision

Return

Return Statements in the Global Scope

return stops the execution of the script, and can be used to return a value to the calling application

return; // exits the script 
return 1; // exits the script and returns 1 to the calling application

Return Statements in a Function Definition

return stops the execution of a function, and returns the specified value to the caller

string func() {
   return "hello";
}

string val = func();  // set val to the value that is returned by func

Clone this wiki locally