
The Command Set 
&  
Type:  Operator 
Syntax:  &{<variable<function>} 
Explanation:  The address operator determines the address of a variable, of a field, or of a function.
The following is indicated here:  in the case of numerical single variables, the value of the variable  in the case of individual string variables, a 4byte pointer to the actual string, followed by a 4byte string length  in the case of numerical fields, a pointer to the actual field  in the case of string fields, a pointer to a field containing the pointer to the elements of the string field and their length  in the case of functions, a pointer to the function In order to access the variable, it is possible to also employ the "*" dereferencing operator. The address operator in particular can be utilized in order to pass pointers to fields or functions to procedures and functions respectively. Consequently, fields can be processed locally and functions can be called indirectly. "*" accesses an object (dereferences it). The pointer variable must follow directly behind the operator. Just as in the case of a normal variable, the proposed type has to be indicated with a postfix. "*" calls the function to which the pointer variable points, especially in case of a pointer to functions. Note: The address operator is very important for direct MAC_OS calls, because for many of these functions, pointers do have to be passed to variables in which MacOS then returns the results. Extreme care has to be taken to indicate the correct type; an automatic adaptation such as it occurs in the case of Omikron Basic is not performed by the MacOS. 
Example:  Text$="This is a sample text" Ptr_Text=&Text$ PRINT *Ptr_Text$:'The $ character is important! Sum=0 Ptr_Sum=&Sum N=10 FOR I= 1 TO N *Ptr_Sum=*Ptr_Sum+I*I NEXT I PRINT Sum 
Result:  This is a sample text 385 
See also:  VARPTR * (as pointer operator) 
(,)  
Type:  Operator 
Syntax:  (<expression>) 
Explanation:  An expression placed within parentheses always has the highest priority and is computed ahead of any other expression. Expressions in parentheses can be nested as desired. It is also possible to interpret the parenthesis as a function, which returns the result of <expression> as the function value. 
Example:  PRINT 3*5+7 PRINT 3*(5+7) 
Result:  22 36 
See also:  Priority of the Operators 
* (as pointer operator)  
Type:  Operator 
Syntax:  *{<variable><function>} 
Explanation:  In order to be able to use the pointer operator, it is first necessary to determine
the address of an object (variable, field, or function) by using the address operator
"&". The expression 'Ptr_Str_Cmp=&FN Cmp(A$, B$)' saves
a pointer to the function 'FN Cmp(,)' in the variable 'Ptr_Str_Cmp'  meaning their
addresses. The function can now be called indirectly with this pointer (e.g., 'PRINT
FN *Ptr_Str_Cmp("A","B")'). Just as pointers to a field, such function pointers can be passed to procedures. It would be possible to use a sort procedure with the abovementioned example, which only receives a function pointer for the string comparison. The sorting criteria are contingent on the logical operator (e.g., ascending, descending, or upper case = lower case ...) Important: Close attention has to be paid to ensure that the parameter lists of the functions that can be called via pointers are in precise agreement. The compiled product cannot carry out any type adaptation at runtime since it is not known to which function the pointer is referring at any point in time. In the above example, FN *Ptr_To_Df_Fn may only be called with a double float parameter (here X#). The otherwise necessary conversion of integer to double float cannot occur automatically, the integer parameter would pass incorrectly. 
Example:  'This example can also be found in the DEMO folder Ptr=&FN Sin2#(X#) PRINT "Value Table of SineSquared:" :PRINT Values_Tab Ptr,0#,PI,0.2# SCREEN 1,80,80,320,400 PRINT "Value Table of CosineSquared:":PRINT Values_Tab &FN Cos2#(X#),0#,PI,0.2# REPEAT COMPILER "EVENT" UNTIL 0 END DEF FN Sin2#(X#)= SIN(X#)* SIN(X#) DEF FN Cos2#(X#)= COS(X#)* COS(X#) DEF PROC Values_Tab(Ptr_To_Df_Fn,From#,To#,Step#) LOCAL X# For X#=From# TO To# STEP Step# PRINT USING "##.#;X#; USING "";TAB(5);FN *Ptr_To_Df_Fn#(X#) 'Caution: While the program is running, it is impossible to check the type NEXT X# END_PROC 
Result:  Two windows will be opened and the squares of sine and cosine displayed in each case. 
See also:  & VARPTR 
* (as a multiplication operator)  
Type:  Operator 
Syntax:  {<num.expression><string expression>}*<num.expression> 
Explanation:  The multiplication operator multiplies the expression indicated to its left with the numerical expression indicated to its right. Instead of the numerical expression, a string expression can also be employed on the left side. 
Example:  PRINT 5*7 PRINT "Basic"*3 
Result:  35 BasicBasicBasic 
See also:  / \ STRING$ SPACE$ SPC MAT *(as pointer operator) 
+ (as sign)  
Type:  Operator 
Syntax:  + <num.expression> 
Explanation:  The positive sign operator indicates that this numerical expression is a positive number. The "+" operator acts as a multiplication by 1, thus not changing the value of the number. In general, it can be omitted. Omikron Basic employs a blank space instead of the "+" character during the output of numbers. However, this behavior can be changed with USING. 
See also:  +  (as signs) 
+  
Type:  Operator 
Syntax:  {<num.expression> + <num.expression >  <string expression > + <string expression >} 
Explanation:  The addition operator adds the expression on its left to the expression on its right. Instead of numerical expressions, string expressions can also be used; however, a combination of both is not permissible. 
Example:  PRINT 100+21 PRINT "Omikron"+"Basic "+" Version 6" 
Result:  121 Omikron Basic Version 6 
See also:   + (as sign) MAT 
 (as sign)  
Type:  Operator 
Syntax:   <num.expression> 
Explanation:  The negative sign operator indicates that this numerical expression is a negative number. The "" operator acts as a multiplication by 1, thus negating the value of the number. The operator is inverse to itself. Therefore, a double application thus produces again the initial number. 
Example:  A=1234 PRINT A,(A+1) 
Result:  1234 1233 
See also:   + (as sign) 
  
Type:  Operator 
Syntax:  <num.expression>  <num.expression > 
Explanation:  The subtraction operator subtracts the expression on its right from the expression on its left. However, only numerical expressions are permitted but no string expressions. 
See also:  +  (as signs) MAT 
/  
Type:  Operator 
Syntax:  <num.expression> / <num.expression> 
Explanation:  The division operator divides the expression on its left by the expression on its right. However, only numerical expressions are permitted and no string expressions. 
See also:  \ * MAT 
\  
Type:  Operator 
Syntax:  <num.expression> / <num.expression> 
Explanation:  The integral division operator divides the expression on its left by the expression on its right. However, only numerical expressions are permitted, no string expressions. In contrast to the normal division operator, the returned result is always an integer. If therefore, the division cannot divide exactly, the result is rounded down to the next smaller integer. 
Example:  PRINT 10/4,10\4 
Result:  2.5 2 
See also:  / * MOD 
^  
Type:  Operator 
Syntax:  <num.expression> ^ <num.expression> 
Explanation:  The power operator raises the expression on its left to the power indicated by the
expression on its right. However, only numerical expressions are permitted, no string
expressions. Note: Calculation occurs through a series expansion. Therefore, this operation is very slow compared to the basic arithmetic operations. If the operation can also be written as a basic arithmetic operation, it is better to use it instead (e.g., X*X is executed much faster than X^2, 1/X is better than X^1, SQR(X) is more rapid than X^0.5) 
See also:  LOG LN SQR * / 
<  
Type:  Operator 
Syntax:  {<num.expression> < <num.expression>  <string expression> < <string expression>} 
Explanation:  The 'less than' operator compares the expression on its left with the expression
on its right. Instead of numerical expressions, string expressions can also be used;
however, a combination of both is not permitted. The result is a Boolean value. If
the expression on the left side of the operator is less than the expression on the
right side of the operator, the returned result amounts to 1, otherwise 0. In the case of strings, the logical comparison is performed character by character in terms of the respective ASCII value of the sign. Thus, "a" is less than "b". The strings may also differ in lengths. Note: Such logical comparisons are generally used to control the program with such structure commands as IF, WHILE, UNTIL. 
See also:  <= = >= > <> 
<=  
Type:  Operator 
Syntax:  {<num.expression> <= <num.expression >  <string expression > <= < string expression >} 
Explanation:  The 'less than or equal to' operator compares the expression on its left with the
expression on its right. Instead of numerical expressions, string expressions can
also be used; however, a combination of both is not permissible. The result is a
Boolean value. If the expression on the left side of the operator is lesser than
or equal to the expression on the right side of the operator, the returned result
amounts to 1, otherwise 0. In the case of strings, the comparison is performed character by character in terms of the respective ASCII value of the sign. Thus, "a" is less than or equal to "b". The strings may also differ in lengths. Note: Such logical comparisons are generally used to control the program with such structure commands as IF, WHILE, UNTIL. 
See also:  < = >= > <> 
=  
Type:  Operator 
Syntax:  {<num.expression> = <num.expression >  <string expression > = <string expression >} 
Explanation:  The logical comparison (equal to) operator compares the expression on its left with
the expression on its right. Instead of numerical expressions, string expressions
can also be used; however, a combination of both is not permissible. The result is
a Boolean value. If the expression on the left side of the operator is equal to the
expression on the right side of the operator, the returned result amounts to 1,
otherwise 0. In the case of strings, the comparison is performed character by character in terms of the respective ASCII value of the sign. Thus, "a" is equal to "b". The strings may also differ in lengths. In that case, however, the result is always 0. Note: Such logical comparisons are generally used to control the program with such structure commands as IF, WHILE, UNTIL. 
See also:  < <= >= > <> 
>=  
Type:  Operator 
Syntax:  {<num.expression> >= <num.expression >  <string expression > >= <string expression >} 
Explanation:  The 'greater than or equal to' operator compares the expression on its left with
the expression on its right. Instead of numerical expressions, string expressions
can also be used; however, a combination of both is not permissible. The result is
a Boolean value. If the expression on the left side of the operator is greater than
or equal to the expression on the right side of the operator, the returned result
amounts to 1, otherwise 0. In the case of strings, the comparison is performed character by character in terms of the respective ASCII value of the sign. Thus, "b" is greater than or equal to "a". Note: Such logical comparisons are generally used to control the program with such structure commands as IF, WHILE, UNTIL. 
See also:  < <= = > <> 
>  
Type:  Operator 
Syntax:  {<num.expression>> <num.expression >  <string expression >> <string expression >} 
Explanation:  The 'greater than' operator compares the expression on its left with the expression
on its right. Instead of numerical expressions, string expressions can also be used;
however, a combination of both is not permissible. The result is a Boolean value.
If the expression on the left side of the operator is greater than the expression
on the right side of the operator, the returned result amounts to 1, otherwise 0.
In the case of strings, the comparison is performed character by character in terms of the respective ASCII value of the sign. Thus, "b" is greater than "a." Note: Such logical comparisons are generally used to control the program with such structure commands as IF, WHILE, UNTIL. 
See also:  < <= = >= <> 
<>  
Type:  Operator 
Syntax:  {<num.expression> <> <num.expression >  <string expression > <> <string expression >} 
Explanation:  The 'not equal to' operator compares the expression on its left with the expression
on its right. Instead of numerical expressions, string expressions can also be used;
however, a combination of both is not permissible. The result is a Boolean value.
If the expression on the left side of the operator is not equal to the expression
on the right side of the operator, the returned result amounts to 1, otherwise 0.
In the case of strings, the comparison is performed character by character in terms of the respective ASCII value of the sign. Thus, "a" is not equal to "b". The strings may also differ in lengths. In that case, the result is always 0. Note: Such logical comparisons are generally used to control the program with such structure commands as IF, WHILE, UNTIL. 
See also:  < <= = >= > 
= (as allocation)  
Type:  Command 
Syntax:  {<num.variable> = <num.expression><string variable> = <string expression>} 
Explanation:  The allocation operator assigns the expression on its right to the variable on its left. Only a numerical expression can be assigned to numerical variables, and only a string expression can be assigned to string variables. A combination of both is inadmissible. 
See also:  LET 
+=  
Type:  Operator 
Syntax:  <num.variable> += <num.expression> 
Explanation:  This operator adds a numerical expression to a numerical variable and then immediately
reassigns the result to the variable. Therefore, A+=B is tantamount to A=A+B; however,
it can be translated more effectively by the compiler. It is advisable, to make use
of this style as often as possible. Note: The Omikron Basic compiler always attempts to translate an expression such as the format A=A+B as A+=B. Nevertheless, use of the operator "+=" is advised. 
See also:  = *= /= 
=  
Type:  Operator 
Syntax:  <num.variable> = <num.expression> 
Explanation:  This operator subtracts a numerical expression from a numerical variable and then
immediately reassigns the result to the variable. Therefore, A=B is tantamount to
A=AB; however, it can be translated more effectively by the compiler. It is advisable,
to make use of this style as often as possible. Note: The Omikron Basic compiler always attempts to translate an expression such as the format A=AB as A=B. Nevertheless, use of the operator "=" is advised. 
See also:  += *= /= 
*=  
Type:  Operator 
Syntax:  <num.variable> *= <num.expression> 
Explanation:  This operator multiplies a numerical expression with a numerical variable and then
immediately reassigns the result to the variable. Therefore, A*=B is tantamount to
A=A*B; however, it can be translated more effectively by the compiler. It is advisable,
to make use of this style as often as possible. Note: The Omikron Basic compiler always attempts to translate an expression such as the format A=A*B as A*=B. Nevertheless, use of the operator "*=" is advised. 
See also:  += = /= 
/=  
Type:  Operator 
Syntax:  <num.variable> /= <num.expression> 
Explanation:  This operator divides a numerical variable by a numerical expression and then immediately
reassigns the result to the variable. Therefore, A/=B is tantamount to A=A/B; however,
it can be translated more effectively by the compiler. It is advisable, to make use
of this style as often as possible. Note: The Omikron Basic compiler always attempts to translate an expression such as the format A=A/B as A/=B. Nevertheless, use of the operator "/=" is advised. 
See also:  += = *= 
{...}  
Type:  Command 
Syntax:  {<program text>} 
Explanation:  An area enclosed in braces { } within the source code can be summarized as one single line using the editor function 'Fold Area'. The command does not influence the program execution and is ignored by the compiler. 
See also:  Fold Area Unfold Area Unfold All 
?  
Type:  command 
Syntax:  ? [[<expression>][,[[<expression>]<,;>]...] Each word 'expression' can be replaced by: {TAB(<num.expression>)  USING [<string expression>]  <num.expression>  <string expression>} 
Explanation:  The question mark has the same definition as the PRINT command. The editor will immediately convert it into PRINT after exiting the line. 
See also:  
' (comment)  
Type:  Command 
Syntax:  '<string constant> 
Explanation:  A comment is introduced with the single quotation mark. Anything following the single quotation mark will be ignored by the compiler. Ample use should be made by the opportunity to add comments to the program. This makes it easier to still understand the program execution even after the user has not worked with the program for a longer period of time. 
See also:  REM 
@  
Type:  Function 
Syntax:  @(<num.expression>,<num.expression) @(<line>,<column>) 
Explanation:  This function returns a control string. If this string is output with commands such
as e.g., PRINT, LPRINT,
or INPUT, the cursor will be placed in the line and
column specified behind "@". In the case of LPRINT, certain restrictions may apply, because it is obvious that the cursor cannot be placed in a location that has already been printed out. 
See also:  PRINT @ 
TechSupport  Order  Start  Home: http://www.berkhan.com 
© 19972001 BerkhanSoftware 