PickBASIC / FlashBASIC

BASIC overview

.md

This general overview includes information on these topics:

In this section

Attribute count expressionAn attribute count expression (ac expression) is any numeric constant or any arithmetic, logical, or string expression that evaluates to a valid numeric value, used to reference an attribute count within statements, functions, and arrays or string variable.Arithmetic expressionsArithmetic expressions perform mathematical calculations on any set of operand expressions.Arithmetic operatorsArithmetic operators add, subtract, multiply, and divide numeric operands in arithmetic expressions.ArraysPick BASIC has two types of arrays:Array referencesDimensioned and Dynamic arrays can be referenced in BASIC programs.Array variableAn array variable references a dynamic or dimensioned array.Arrays and relational expressionsIndividual elements of dimensioned and dynamic arrays are compared in relational expressions using the standard syntax.AssignmentAssignment is the process of assigning the value of an expression to a variable.Boolean evaluationTraditionally, the result of a logical or Boolean expression is considered true if it evaluates to 1 and false if it evaluates to 0.Compile stampsCompile stamp items contain descriptive internal information about programs compiled for BASIC.Conversion expressionA conversion expression is any function that evaluates to any of the valid processing codes listed below in the See also section.Data representationData representation refers to the data types employed in BASIC. There are primarily two types of data:Default File VariablesThe following statements make use of a feature known as default file variables:Error conditionAn error condition is the process state that occurs when a program encounters a condition that cannot be resolved, forcing an abort to the FlashBASIC or BASIC debugger. For example, if a reference is made to a dimensioned array subscript less than 1 or greater than the number defined in the dim statement a nonrecoverable error occurs.File variableA file variable is the symbolic way to access a file after being previously opened in a BASIC program. File variables are assigned with the open statement.Format stringsNumeric and nonnumeric strings can be formatted using format strings, which consist of numeric masks and format masks. The numeric mask code controls justification, precision, scaling, and credit indication. The format mask code controls field length and fill characters.FunctionsFunctions are elements in BASIC language expressions, returning a single value in place, as a function of the arguments. A function can be used anywhere a variable or expression is used.Global CommonGlobal common is a named BASIC variable space used to store variables and arrays in the identified area that is only initialized at logon.ID expressionAn ID expression is a string expression that evaluates to an item-ID, for use in all types of read and write statements.Logical expressionsLogical expressions (also called Boolean expressions) are the result of applying logical (Boolean) operators to relational or arithmetic expressions. The result of an operation has two possible states: true or false. Logical expressions are considered false when equal to 0, and are considered true when nonzero.MaskingMasking is the process of formatting expressions using numeric masks and format masks.Named commonA named common is a global, common, BASIC variable space used to store variables and arrays in the area identified by ID. Named common space is initialized only at logon and released at logoff.Nonfatal error conditionA nonfatal error condition is a type of error that occurs when a BASIC program encounters a condition that is resolved by the BASIC run-time package, although not to the specific need of the program line of code.Nuclear tokensAny function or expression can itself be an argument of another function or expression. The compiler evaluates expressions starting with the innermost set of parentheses.Null evaluationRepresents an empty string or decimal zero value depending on the context, string, or arithmetic operation.Numeric expressionsA numeric expression is any expression that evaluates to a number.OperatorsOperators are reserved characters (and combinations of adjacent characters) and can be referenced individually by their respective symbol.PrecedencePrecedence is the set of rules imposed upon the evaluation of components of an expression that are not otherwise overridden by the presence of parentheses.Relational expressionsA relational expression evaluates to 1 if the relation is true, and evaluates to 0 if the relation is false. Relational operators have lower precedence than all arithmetic and string operators. Therefore, relational operators are only evaluated after all arithmetic and string operations have been evaluated.Relational operatorsRelational operators are used to compare both strings and/or numerics.Reserved charactersReserved characters are the characters that are reserved for special purposes.Reserved wordsThe rules for reserved words are:Retrieval locksIf a BASIC program is run by a user that does not have retrieval or update privileges (for a file that does and is opened in the program), and then attempts to read and/or write to that file, the program terminates with an error message. In order to read or write to such a file, users must make sure that the retrieval and update lock codes match those of the file that is opened. This is a system function and cannot be accomplished from BASIC. If the file is retrieval protected, the file cannot be opened and the program is terminated with an error message.Subvalue count expressionsA subvalue count expression (sc expression) is an expression that evaluates to a valid subvalue count.statement blocksA statement block is one or more statements that follow a BASIC decision-path related token such as, but not limited to, then, else, locked, and onerr.statement labelsstatement labels are used as the destination of a goto or gosub statement.Statements and functionsThis topic describes the differences between statements and functions in BASIC and provides working definitions of variables, constants, labels, spaces, and program formatting.String expressionsA string expression is any expression that evaluates to, or can be converted to a string of characters.SubstringsA substring is a set of characters that makes up part of a whole string. The syntax to specify a substring is:Substring expressionsA substring expression extracts or assigns substrings by using the [ and ] characters.Symbol table (BASIC)When a BASIC program is compiled, a symbol table is generated, unless the s (suppress table) option has been used with the compile or basic. The symbol table is used by the BASIC debugger to reference symbolic variables.then/else statement blocksthen/else statement blocks are found in conjunction with conditional statements.Value count expressionA value count (vc) expression is an expression that evaluates to a valid value count.VariablesVariables store numbers, strings, file descriptors, or select lists and can change dynamically throughout the execution of the program.