AFL
Arguably Functional Language
AFL Documentation
Variables
AFL supports variables, which are used to store values. Assigning a variable is fairly simple:
name = value or expression
Valid names are of any length, and only consist of upper and lower case letters. The recommended way to capitalize variables is camelCase or UpperCamelCase. some examples of variable assigning:
x=12; output = "The answer is: "+27.5+'!' someNumber=pi*sqrt(2)
Variables can be recalled by using their name in place of a constant value. For full clarity, here is an example:
x=27; x=x+1; # Expected value is 28 x
Variable Scoping
Variables are scoped by functions. This means that a variable first declared outside a function is available to all functions, but a variable declared inside a function is only accessible within that function. If that variable is used in another function, it refers to an unrelated value. A variable cannot be first declared in a function, then used outside of one.
Here is an example:
# this code will produce an error, as x is undefined in function b. function("a" 0); x=201; end(); function("b" 0); x; end(); a(); b()