Anonymous user
Call a function: Difference between revisions
→{{header|Mathematica}}
Line 200:
There are no ''differences between calling subroutines and functions'' because J defines neither <code>subroutines</code> nor <code>functions</code>. Instead, J defines <code>verbs</code>, <code>adverbs</code>, and <code>conjunctions</code> which for the purpose of this task are treated as functions.
=={{header|Mathematica}}==
Calling a function that requires no arguments:
f[]
Calling a function with a fixed number of arguments:
f[1,2]
Calling a function with optional arguments:
f[1,Option1->True]
Calling a function with a variable number of arguments:
f[1,Option1->True]
f[1,Option1->True,Option2->False]
Calling a function with named arguments:
f[Option1->True,Option2->False]
Using a function in statement context:
f[1,2];f[2,3]
Using a function in first-class context within an expression:
(#^2)&[3];
The return value of a function can be formally extracted using Return[]
Built-in functions names by convention start with a capital letter.
No formal distinction between subroutines and functions.
Arguments can be passed by value or by reference.
=={{header|PARI/GP}}==
|