4,500
edits
m (→Examples) |
(→A+) |
||
Line 26: | Line 26: | ||
== A+ == | == A+ == | ||
[[A+]] uses a reworked | [[A+]] uses a reworked style of function and operator definition than maintains the principle of a header that matches the way the function will be used, but differs in many details: | ||
* The result name is not included in the header; instead, the result of the last executed statement is returned (and so | * The result name is not included in the header; instead, the result of the last executed statement is returned (and so functions that do not return a result cannot be defined). | ||
* The header is separated from the body with a colon, and the body of a multi-line function is enclosed in curly braces. | * The header is separated from the body with a colon, and the body of a multi-line function is enclosed in curly braces. | ||
* Functions have lexical scope. Variables assigned are local by default, and can be made global by enclosing their names in parentheses when assigning. | * Functions have lexical scope. Variables assigned are local by default, and can be made global by enclosing their names in parentheses when assigning. |