Call a function: Difference between revisions
Content deleted Content added
→version 1: added more comments, changed some comments, added whitespace and indentation of boxed comments, created separate program elements, aligned structures and statements. |
|||
Line 1,361: | Line 1,361: | ||
(apply function (append args-1 args-2)))) |
(apply function (append args-1 args-2)))) |
||
(funcall (curry #'+ 1) 2) |
(funcall (curry #'+ 1) 2) |
||
</lang> |
|||
=={{header|Cubescript}}== |
|||
<lang Cubescript> |
|||
// No arguments |
|||
myfunction |
|||
// All functions can take a variable number of arguments. |
|||
// These can be accessed from within the function with the aliases: |
|||
// $arg1, $arg2, $arg3... $numargs tells the amount of args passed. |
|||
myfunction word "text string" 1 3.14 |
|||
// Getting a function's return value |
|||
retval = (myfunction) |
|||
// Trying to do a variable lookup on a builtin function will return an empty |
|||
// string. This can be used to distinguish builtin functions from user-defined |
|||
// ones. |
|||
if (strcmp $echo "") [echo builtin function] // true |
|||
if (strcmp $myfunction "") [echo builtin function] // false |
|||
</lang> |
</lang> |
||