The basics

This article contains general information about RFO-BASIC!.

The language
RFO-BASIC! is an interpreted programming language. That is, when you develop an app in BASIC, it is not "compiled" into machine code but remains in text form. The BASIC interpreter reads statements in sequence and carries out your wishes. (The separate BASIC compiler in fact produces an APK file consisting of your BASIC program and the interpreter.)

The BASIC program consists of lines. Android devices separate lines using the  character, while some external editors use the sequence ,. Here are general rules about separating a program into lines:
 * Source text
 * A BASIC statement must be on a single line, except that it is usually possible to type  at the end of a line and continue the statement on the next line.
 * You can put more than one BASIC statement on a line, separating them by .  (Certain statements use the   character in their syntax.  In this case, you must be careful that typing multiple statements on a line is not ambiguous.
 * Programs can (and should) contain comments to help you understand them. The traditional   statement is available to introduce a line of comments.  A line starting with   is also a line of comments that is not interpreted when the program is executed.
 * A line starting with  introduces a range of comment lines.  Another such line ends the range.  This is an easy way to disable entire sections of code.  However, it is easy to create bugs that are difficult to solve, either by not terminating the range or by forgetting that you disabled the code.

In general, you can type in capital or lowercase letters and it doesn't make a difference, even when creating labels. For example, the variable  is the same as the variable. Internally, RFO-BASIC! converts everything into lowercase. If a program stops with a syntax error, the line that RFO-BASIC! reports will be converted into lowercase. On the other hand, the Formatter puts RFO-BASIC!'s predefined keywords into capitals, as they are shown in this manual.
 * Capitalization

There are certain situations where case is important:
 * Case is important inside literals, and RFO-BASIC! never changes it. For example:
 * Case is important when defining or specifying the keys of a bundle. (The key is the name of an element of the bundle.)
 * Case is important when making a query with the SQL statements.
 * Case is important in the names of files on the Android device.   is a different file from  .  (This is not true with files on thumbdrives or microSD cards; these use a different file system that evolved from DOS/Windows.)  An RFO-BASIC! program that lets the user specify filenames ought to post-edit the user to enforce consistent use of capital letters or lowercase.

Unlike classic BASIC, RFO-BASIC! programs do not have line numbers, and adding line numbers to a program will make it fail. The GOTO and GOSUB statements do not specify a line number to jump to, but an alphanumeric statement label that ends with a colon. For example:
 * Program control

StatementLabel1:

GOTO and GOSUB statements are not necessary compared to classic BASIC. In addition to traditional loops using FOR and NEXT, you can code loops with the WHILE and REPEAT statements (in which a condition is tested at the start of the loop) and the DO and UNTIL statements (in which a condition is tested at the end of the loop). For each of these pairs, RFO-BASIC! provides a statement that immediately starts the next pass through the loop, and a statement that immediately exits the loop. These statements are preferable to using GOTO or RETURN to jump out of the loop. If you jump out of a loop, RFO-BASIC! does not discard information on the loop from its control stack.

Here is the complete set of looping statements: