AFL

Arguably Functional Language



AFL Documentation

AFL Basics


This help entry contains a broad overview for a number of basic topics required to understand most AFL code. Hopefully most of it is relatively straightforward.

Data Types

AFL has various types of data that you can manipulate, and has specific ways of writing them as constants. The various types are num, string, char, bool, array, and type. For more information on data types, see their corresponding entry.

Printing

AFL has no print statement. If you want to print something to the console, just type it out! Here are some examples:

"Hello, World!"

1+1

round(1.1)

Multiple Statements

Statements in an AFL program are separated by semicolons. This is always the case, no matter where the semicolon is in AFL code. Because statements are separated by semicolons, and not ended by them, AFL expects the last statement in a piece of code to not be ended by a semicolon. If you want to use a semicolon in a way that does not denote a new statement, you can escape them with a backslash. See the entry on escape sequences to learn more about escaping other characters.

If you are typing a program in the shell, pressing enter after typing a semicolon will let you write multiple lines of code, though putting multiple statements in a single line is also valid.

Variables & Arrays

AFL supports variables, which are used to store values. Assigning a variable is fairly simple:

x = 2+1; "x squared:"; x*x

If you want more specific information on variables and variable scoping, check out the entry on variables below.

AFL also supports arrays, which are special variables that can store multiple values. Check out the entry on arrays for more information.

Comments

AFL provides ways to insert comments that are not executed into your code, usually to explain the function of your code. AFL uses # to denote a comment for a single line, though note that semicolons in comments have to be escaped.

Operators and Functions

AFL provides various ways to modify values. These include operators such as +, *, and ==, and functions, such as round(num) and random(). Functions in particular do not have to output any value, however. You can also create your own functions. To learn how to make and call functions, see the corresponding entry on functions below.

Control Statements

AFL also supports what it calls control statements, which are functions that modify the flow of code execution. These include the commonplace if(bool) and while(bool). To see syntax for them and a list of all control statements, see the corresponding entry below