AFL
Arguably Functional Language
AFL Documentation
Data Types
AFL has various types of data that you can manipulate, and has various ways as writing them as constants. All types of data can be put into variables. This Entry contains a list of data types, how to enter them as constants, and some assorted notes on them.
num
The num data type is for storing numbers. All num's are double precision floating points, completely stolen from java. They may be entered as expected for the most part, but AFL refuses to recognize scientific notation, values like NaN and Infinity, and negative numbers as numbers, when written as constants, though these values can still be obtained with expressions. Note that there is a utility function for producing a negative number, neg(num).
string
The string data type represents text, and is written as a constant using quotation marks, like so:
"Hello, World!"
Strings can be easily combined (or other types can be appended on to strings) by using the + operator. They can also be converted to and from arrays of char type data using the toCharArray(string) and fromCharArray(array) functions. Certain characters cannot be easily inputed into strings, and for these characters, escape sequences are available. See the entry below for more information.
char
The char data type represents a single character, such as 'a', '!' or '1'. They are represented by single quotes surrounding the character in question, like shown above. Certain characters cannot be easily inputed, and for these characters escape sequences are available. See the entry below for more information.
bool
The bool data type represents true or false, and are the results of comparisons e.g. x>10. They are represented by the words true and false, fittingly enough.
array
The array data type cannot be directly represented, though they are stored in variables. They are manipulated through array functions. arrays represent multiple values in one, indexable by a num. For more information on arrays and how to use them, see the corresponding entry.
type
The type data type represents the data types, num, string, char, bool, array and type, and are written as such. types are used most often when determining the type of a potentially unknown variable, typically like so:
if(typeOf(x)==num); # do something if x is a num end(); else(); # do something if x is not a num end()