Using Nasal functions: Difference between revisions

Jump to navigation Jump to search
m
make example more explicit
m (make example more explicit)
Line 6: Line 6:
var square = func(number) {
var square = func(number) {
  return number*number;
  return number*number;
}
};
</syntaxhighlight>
</syntaxhighlight>


Line 16: Line 16:
* return the result of number*number to the caller
* return the result of number*number to the caller
* close the function body (the closing curly brace)
* close the function body (the closing curly brace)
* and terminate the expression via the semicolon


So, to put things in layman's terms, imagine your function like a recipe in a cooking book - instead of always having to write down the recipe, you just open the cooking book, "jump" to the corresponding page, "execute" the recipee and then "return" to where you left off earlier.
So, to put things in layman's terms, imagine your function like a recipe in a cooking book - instead of always having to write down the recipe, you just open the cooking book, "jump" to the corresponding page, "execute" the recipee and then "return" to where you left off earlier.

Navigation menu