Call a function: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) No edit summary |
Drkameleon (talk | contribs) No edit summary |
||
Line 392: | Line 392: | ||
// Calling a function that requires no arguments |
// Calling a function that requires no arguments |
||
printHello |
|||
// Calling a function with a fixed number of arguments |
// Calling a function with a fixed number of arguments |
||
sayHello "John" |
|||
// Calling a function with a variable number of arguments |
// Calling a function with a variable number of arguments |
||
printAll #("one" "two" "three") |
|||
// Using a function in statement context |
// Using a function in statement context |
||
if true { |
if true { printHello } |
||
// Using a function in first-class context within an expression |
// Using a function in first-class context within an expression |
||
if $( |
if $(getNumber)=3 { "yep, it worked" } |
||
// Obtaining the return value of a function: |
// Obtaining the return value of a function: |
||
num $( |
num $(getNumber)</lang> |
||
{{out}} |
{{out}} |