This Language reference describes the commands, methods, attributes, and so on, that you can include in the BASIC code you use to build FirstClass RAD applications.
BASIC commands
BatchAdmin (Command, OptionalBufferSize)
Command
The single-line batch admin command to be sent.
OptionalBufferSize
An integer value for the number of bytes of buffer to reserve for the answer, for example 4096 would be 4k. The limit to this buffer is the available memory on the server machine.
Beep
Plays the FirstClass client's system beep sound.
The FirstClass client cannot play the system beep unless the application has displayed a form.
Syntax
Beep
Example
Sub Click()
Dim i as integer
For i = 1 to 3 'Beep 3 times
Beep Next i
End Sub
Call
Calls a subroutine.
This is an optional command; you can call subroutines directly without using it.
Syntax
Call subroutine
Call subroutine(arg1, arg2...)
subroutine
You can add arguments (arg1, and so on) to this command.
Example
Sub Main()
Call MyStartupSub(StartupString)
Call MyMainProgramSub(1, "John", TRUE)
Call MyEndSub
End Sub
Console
Displays output (printexpressions) on the server console.
This command is identical to the Print command, except that output is directed to the server console instead of the FirstClass client's output window. If you also want to write output to the server's log file, use the Report command.
Syntax
Console [printexpression,printexpression]
Console [printexpression,printexpression]
For an explanation of this syntax, see the Print command.
Example
Console "Welcome to my application"
Console "Hello"; FCUserName
Console "the value of 'i' is";i
Const
Declares a user-defined constant.
Syntax
Const constname = expression
Const constname As datatype = expression
You can assign any type of expression to the constant. You can also specify a data type. If you do not specify a data type, the data type of the assigned expression is used.
Example
Sub Main()
Const MYSTRING = "Hello world"
End Sub
CopyFile
Copies a file on the FirstClass server from one location to another. It uses the host operating system to issue a copy from one location to another.
Syntax
CopyFile(FromPath, ToPath, TRUE/FALSE)
The third parameter determines whether or not the copy will overwrite an existing file.
Example
CopyFile ("C:\FCSERVER\FCS.OLD","C:\FCSERVER\FCS2.OLD",FALSE)
Debug
Prints text to the console window only when the program is run from the development environment.
The Debug command acts exactly like the Print keyword except that it is not executed when the built application is run, but is activated when run from the development environment. This is useful to prevent users from seeing debugging information after you build and release the application.
Syntax
Debug StringToSend
Example
Sub Main()
Print "This string will always be printed"
Debug "This string only shows up when run from the development environment"
End Sub
Dim
Declares a variable and allocate storage memory.
Syntax
Dim varname As vartype
Dim varname(arrayupperbound) As vartype
Dim varname(arraylowerbound To arrayupperbound) As vartype
Dim varname As String * length
Dim varname1 As vartype, varname2 As vartype...
The variable name (varname) can be any valid alphanumeric string, as long as it does not begin with a decimal number (0-9) or an underscore (_). Underscores and decimal numbers are allowed in any other location in the variable name.
You must specify the variable type (vartype). Valid types are Integer, Long, Single, Double, Date, Currency, String, and user-defined types.
You can create arrays (array...bound) of variables of up to 61 dimensions, with no more than 1,000,000 elements. You can also declare a string variable of a fixed length (length). The length argument can be any valid number that indicates the maximum length of the string.
Example
Dim i As Integer
Dim MyArray(10) As Integer 'declare an integer array of 10 elements (0-9)
Dim MyArray(0 To 9, 0 To 9) As Double 'declare a two-dimensional array
Dim str2 As String * 100 'declare a fixed-length string of 100 characters
Do...Loop
Executes a group of subcommands while a conditional expression is TRUE or until a conditional expression evaluates to TRUE.
Syntax
Do While condition commands...Loop
Do Until condition commands...Loop
Do commands...Loop While condition
Do commands...Loop Until condition
When a loop reaches its last subcommand, the conditions (condition) of the loop are re-evaluated. The loop then either iterates or processing continues at the first line after the loop. There are four types of Do...Loops (Do While...Loop, Do Until...Loop, Do...Loop While, Do...Loop Until). Each serves a different purpose. The main difference between the two While and Until loops is in the location of the condition.
Do...Loop...condition commands always execute the subcommands at least once, even if the condition indicates that the loop should not iterate. Do While/Until condition...Loop commands only execute the subcommands if the condition indicates that the loop should iterate. Loops using While iterate while the condition is TRUE. Loops using Until iterate until the condition evaluates to TRUE.
Example
Do While Score < 10
Print Score
Loop
Do
Print Score
Loop Until Score > 10
Both loops accomplish the same result.
DoEvents
Interrupts a currently running subroutine to process pending user input.
Use DoEvents to develop applications that respond to user input while the application loops, and to monitor data or update values on the form.
Syntax
DoEvents (starttime, endtime)
Example
Sub Click ()
Dim StartTime as integer
LastTime as integer
Dim IconNumber as integer
Randomize
StartTime = Timer
Do While (Timer < StartTime + 60)
'run loop for 60 seconds
If Timer > LastTime + 1 Then
'every second, run this code
IconNumber = Int ( (9 * Rnd) +1)
'Generate 1 of 9 random icons
DisplayIcon(IconNumber)
End If
DoEvents '**Call DoEvents to process pending input**
Loop
End Sub
End
Ends a structure or procedure.
This command is required to end Sub, Function, Select, and Type structures. It is also required to end If structures unless the If command is all on one line. An End command used by itself stops execution of the application.
Syntax
End
End Sub
End Function
End If
End Select
End Type
Example
If StartupString = "Box" Then
Print "Take the box to the curb"
End
End If
Erase
Clears and reinitializes the values of an array.
All elements of a numeric array are set to zero. All elements of a string array are set to empty strings (''''). Arrays of date values are set to day zero. If the array is of a user-defined type, each member of the type is treated as its own separate variable and is erased in accordance with its type.
Syntax
Erase array
Erase array1, array2...
Example
Sub Main()
Dim MyArray(1 to 10) As Integer
Dim I As Integer
Print "Assigning and Printing My Array"
For I = 1 to 10
MyArray(i)=i
Print MyArray(i)
Next i
Erase MyArray 'All values from array MyArray are now zero
Print "MyArray has been erased and now contains:"
For i = 1 to 10 'Prints all zeros
Print MyArray(i)
Next i
End Sub
Exit
Ends a procedure or loop structure.
In the case of a procedure, processing moves to the line after the procedure call. In the case of a loop structure, processing moves to the line following the loop.
Syntax
Exit
Exit Sub
Exit Function
Exit Loop
Exit For
Example
See code example for the For...Next BASIC command.
For...Next
Executes a group of commands for each increment of a counter.
Syntax
For counter = start To end
subcommands
Next
For counter = start To end
commands
Next counter
For counter = start To end Step increment
subcommands
Next
For counter = start To end
subcommands
condition
Exit For
subcommands
Next
Each time a For...Next loop is iterated, the counter is incremented. You specify start and end values to indicate the initial and final values of the loop counter.
The default increment is 1; however, you can specify a different increment by adding the Step keyword. The increment can be any valid number.
If the increment is negative, the counter will count backwards from start to end. This is the only case where start is greater than end. You can also stop loop processing prematurely if a condition is met by using the Exit BASIC command.
Example
Dim i As Integer
For i = 1 to 10
If i > 5 Then
Exit For 'This will break the loop prematurely.'
End If
Print "Counting:", i
Next i
Next i
Function
Declares a procedure as a function capable of returning a value when it is called.
The name of the function is treated as a variable from within the function and the value will be returned when the function returns. Functions can be of any type and can call other procedures and internal functions to process the result.
Syntax
Function FunctionName(ParameterToFunction As DataType) as DataType
Example
Function MultiplyByTen(X as Integer)
as Integer
MultiplyByTen=MultiplyByTen*10
End Function
Sub Main
Print"Eight times ten is "& MultiplyByTen(8)
End Sub
GiveTime
Suspends application processing and allows the server to re-enter.
All applications are given about the same amount of processing time. If an application knows that it does not need all of its allotted time, it can use GiveTime to give up the remainder of its time to other server processes and applications. All database and field operations, and some commands, initiate their own server re-entrance. In these cases, there is no need to call the GiveTime command.
This is a useful command for applications that are sometimes idle (for example, polling at set times).
Syntax
GiveTime
Example
starttime = Timer
Do While TRUE
If Timer < starttime + 5 Then
Give Time
Else
Print "5 seconds have elapsed..."
starttime = Timer
End If
Loop
Gosub...Return
Jumps to a procedure's labeled subroutine, then returns to the line following Gosub.
We do not recommend use of this command; it is only included for backward compatibility. Instead, use subroutines to handle frequently processed routines. Processing jumps to the line that starts with the label. The label can be either a line number (consisting of the numbers 0-9) or an alphanumeric string (as long as it does not start with a number).
Syntax
Gosub label
...
Return
The label must be the first nonblank characters on the line followed by a colon (:).
Example
Dim I As Integer
For I = 1 to 10
Gosub MySubroutine
Goto MyEnd
Goto
Jumps to a label.
Processing jumps to the line that starts with the label. The label can be either a line number (consisting of the numbers 0-9) or an alphanumeric string (as long as it does not start with a number).
Syntax
Goto label
The label must be the first nonblank characters on the line followed by a colon (:).
Example
Sub Main()
Dim num As Integer
num = 5
Goto 20
Print "This will not get printed"
20 If num = 5 then
Goto numis5
...
If...Then
Branches processing based on a condition.
This command requires a condition that must be TRUE or FALSE. Any numeric condition that is not TRUE is considered to be FALSE. When the condition is TRUE, the commands following this statement are executed, then processing continues on the line following End If.
Syntax
If condition Then command1 Else command2
If condition Then
commands
End If
If condition1 Then
commands
ElseIf condition2 Then
commands
Else
commands
End If
You can include any number of ElseIf...Then clauses with a block If...Then structure to specify additional conditions.
Example
If FCUserid = "guest" Then
Print "Welcome Guest User"
ElseIf FCUserid = "admin" Then
Print "Welcome Administrator"
Else
Print "Welcome" 'user is neither a guest nor administrator
End If
Let
Precedes a variable assignment and assigns values to variables (optional in the BASIC language).
Syntax
Let VariableName = Value
Example
Let X=1
X=1
Load
Loads a form's fields and data resources.
This command makes a form's field and data resources available to the application, but does not make the form visible. To display a form, you must use the Show form method.
Syntax
Load formname
Example
Sub Main()
Load MyForm
If MyForm.MyTable.Column(1) = TRUE Then
MyForm.Title = "My Form's Title"
MyForm.Show
End If
End Sub
MsgBox
Displays a modal message box.
Because this is a modal message box, processing for this application is suspended until the user responds by clicking a button in the message box. At that time, processing continues with the line following the MsgBox command.
Use the MsgBox Response function to tell the application which button the user clicked.
Syntax
MsgBox("msgboxstring")
MsgBox("msgboxstring", msgboxbuttons)
MsgBox("msgboxstring", msgboxbuttons, "msgboxtitle")
MsgBox strings are now truncated at 509 characters. You specify the string to appear in the message box (msgboxstring). You can also add a title to the message box (msgboxtitle), and can specify which buttons you want in the message box (msgboxbuttons). Valid values for msgboxbuttons are:
• fcOKOnly - OK button only
• fcOKCancel - OK and Cancel buttons
• fcYesNo - Yes and No buttons
• fcYesNoCancel - Yes, No, and Cancel buttons.
If you do not specify a title, none appears. If you do not specify message box buttons, just the OK button appears.
Example
MsgBox ("Would you like to save changes?", FCYesNoCancel, "Save")
On Error
Enables or disables error handling.
Syntax
On Error Goto label
On Error Resume
On Error Resume Next
On Error Goto 0
This command is used with the following commands:
• Goto label
Processing jumps to the line that starts with the label if a critical error occurs. The label can be either a line number (consisting of the numbers 0-9) or an alphanumeric string (as long as it does not start with a number). The label must be the first nonblank characters on the line followed by a colon (:).
• Resume
The application will try to re-execute the line that caused the error until it executes successfully. Be careful about using this command, because the application could loop on this line indefinitely.
• Resume Next
Processing resumes with the line after the line that caused the error, including critical errors. Any lines that cause errors are skipped, and processing does not stop for critical errors.
• Goto 0
Turns off error handling from this point on.
Example
Sub Main()
Dim i As Integer
On Error Goto ErrHandler
i=1/0 'division by zero error
Print "Error handling has resumed execution here"
Exit Sub
Option
Sets BASIC interpreter options for this application.
Syntax
Option Base index
Currently, you can only set one option: Base. This option indicates the default index for the first element of arrays with default lower bounds declared with Dim. The index can be 0 (the default) or 1. Option Base must be called from the Declarations procedure of a code module, and can only be called once per application.
Example
Option Base 0
...
Dim MyArray(10) As Integer 'creates a 10-element array indexed from 0 to 9
Option Base 1
...
Dim MyArray(10) As Integer 'creates a 10-element array indexed from 1 to 10
PlaySound
Plays a FirstClass client sound resource. You must specify the resource ID of the FirstClass sound resource.
Syntax
PlaySound(ResourceID)
Print
Displays output (printexpressions) to the FirstClass client's output window.
Syntax
Print
Print printexpression
Print printexpression, printexpression
Print printexpression; printexpression
Print,
Print;
One Print command can output any number of expressions. To specify a string as an expression, enclose it in double quotes ("string"). You can use the following characters with this command:
• comma (,) between expressions
Causes each expression to appear in the print zone following the previous expression. Print zones are located every 14 characters.
• semicolon (;) between expressions
Causes each expression to appear immediately after the previous expression.
• comma (,) or semicolon (;) at end of line.
Suppresses the carriage return that is normally output at the end of the output for each Print command line. Any subsequent Print command output will appear on the same line.
A print Command without a printexpression outputs a carriage return.
Example
Print "Welcome to my application"
Print 1, 2, 3, 4, 5 'prints each number in a separate print zone
Print "These two lines are ";
Print "output as one."
Randomize
Initializes the random number generator.
If you do not use this command, the Rnd function will return the same list of random numbers every time it is run.
Syntax
Randomize [seed]
You can specify the numeric key from which to generate the random number list by using the seed argument. If you use the same value for seed each time a program is run, the same list of random numbers will be generated. If you do not include the seed argument, Randomize generates the random number list using the Timer function.
Example
Dim i As Integer
Randomize
Print "Generating 5 random numbers"
For i = 1 to 25
ReDim
Changes the number of elements in an array.
Using this command on an existing array will replace the old array dimension with the new one.
Syntax
ReDim varname As vartype
ReDim Preserve varname As vartype
ReDim varname (arrayupperbound) As vartype
ReDim varname (arraylowerbound To arrayupperbound) As vartype
ReDim varname1 As vartype, varname2 As vartype...
For an explanation of this syntax, see Dim.
To keep existing values in an array, include the Preserve keyword. If you do not include this keyword, the array is erased as if the Erase command had been used on it.
Example
ReDim Preserve MyArray (MAXVAL+1) As Integer
Rem
Comments out a line of text. The entire line is ignored.
Syntax
Rem comment
'comment
Example
Rem This is a comment 'This is a comment
Report
Writes output (printexpressions) to the server's log file.
This command is identical to the Print command, except that output is directed to the log file and server console instead of the FirstClass client's output window.
If you just want to display output on the server console, use the Console command.
Syntax
Report
Report printexpression
Report printexpression, printexpression
Report printexpression; printexpression
Report,
Report;
For an explanation of this syntax, see the Print command.
Example
Report "Application began at:"; Now
RowCount
This is a statement attribute which returns the number of rows available in a statement.
This is not supported by all ODBC drivers and is not a requirement of the ODBC specification.
RunApp
Runs a built and loaded application in a new application environment space.
Syntax
RunApp("appname")
RunApp("appname", "startupstring")
You specify the application name (appname) with this command. You can also specify any valid string expression as a startup string (startupstring). This string is passed to the launched application as the StartupString value in the launched application.
Example
RunApp("Calc") 'Launches the Calc application
RunApp("Order", "buy12") 'Launches the Order application with the startup string "buy 12"'
Select Case
Builds an expression-based conditional branching of programmatic flow.
Syntax
Select Case testexpression
[Case [Is | # To # ] expressionlist [commands]]
[Case Else] [commands]]
End Select
The Select Case selection structure provides a simplified method for comparing an expression or conditional command to a series of possible expressions or 'cases'.
If the Case is TRUE, the commands following the case are executed. Each case in the selection structure is executed accordingly. Each Select Case selection structure must end with the keywords End Select.
Is and To keywords provide a method for making comparisons within a Case command. Is allows you to use comparison operators while the To keyword allows you to compare and test a range of values for an expression.
Sleep
Halts execution of the program until a specified time has elapsed.
The program can still be unloaded from the server or stopped by closing the form in the case of a stationery-launched application. The Sleep command is of particular use in server applications, where you don't want to consume large amounts of the server CPU calling the program, but want to execute some code on an occasional basis.
Syntax
Sleep(seconds|date)
The parameter can either be an integer, in which case it specifies the number of seconds to sleep before continuing, or the date, in which case the program will not continue until the specified time and date are reached.
Example
Print "This program will self destruct in five seconds!"
Sleep (5)
End
Sort
Sorts a one dimensional array into ascending or descending order.
Syntax
Sort(array)
Using the optional fcAscending and fcDescending parameters, the Sort command can sort arrays of type Integer, Long, Date, String, Single, Double, or Currency, in any order.
Sub
Declares the name and arguments for a sub procedure.
Syntax
Sub name ([ByRef | ByVal] [arg1],[ByRef | ByVal] arg2]...)
The argument name can be any string that is a valid BASIC identifier and cannot begin with underscore characters or decimal digits (0-9).
A Sub can receive any number of arguments. The Sub argument arg can be any valid BASIC identifier and be of any type.
If the keyword ByRef is used, the argument is passed by reference. If the keyword ByVal is used, the argument is passed by value. If no keyword is specified, the default behavior for arguments is passed by value.
Example
Sub DisplayMyUserInfo()
Print "My UserID is "; FCUserID
End sub
Type
Declares a user defined type.
User-defined data types help organize data by making it possible to combine several related variables into a single data structure.
If a user-defined type is defined in the Declarations section of a code module, the type will be visible to the entire application and will remain for the lifetime of the application. If defined in a procedure, the type is only visible to the procedure and will remain only for the lifetime of the procedure.
Syntax
Type typename
varname As datatype
[varname As datatype...]
End Type
Example
Type CustType 'defined in Declarations
First as String
Last as String
SSNum as String *9 'where *9 is a limit to the variable
CustomerID as Integer
End Type
Unload
Closes a form and shuts down its data environment.
Syntax
Unload formname
The Unload command closes the form indicated by the string expression formname. Upon closing, the form runs its Unload event procedure and shuts down the open tables in its data environment.
Example
Sub Click()
Unload MyForm
End Sub
While...Wend
Executes a group of commands while a conditional expression evaluates to TRUE.
The While...Wend loop structure is similar to the Do...Loop structure, but is more limited. The While...Wend structure is included for backward compatibility.
Syntax
While condition
commands
Wend
BASIC operators
&
Concatenates two strings (s1 and s2).
String concatenation adds the second string to the end of the first and returns this as a result string.
Syntax
s1 & s2
Example
Sub Main()
Dim s1 as String, s2 as String, result as String
s1 = "Hello" : s2 = "world"
result = s1 & s2
Print result 'result is assigned 'Hello world'
Print result 'prints Hello world
End Sub
*
Multiplies two numbers (n1 and n2).
Syntax
n1 * n2
n1 and n2 can be any valid numeric expression.
Example
Sub Main()
Print "10 times 4 is:", 10 * 4
End Sub
+
Adds two numbers (n1 and n2) or concatenates two strings (although we recommend & for concatenation).
Syntax
n1 + n2
n1 and n2 can be any valid numeric expressions.
Example
Sub Main()
Print "The sum of 10 and 4 is:", 10 + 4
End Sub
-
Subtracts two numbers (n1 and n2) or negates the value of a number (n).
Subtraction Syntax
n1 - n2
n1 and n2 can be any valid numeric expressions.
Subtraction Example
Sub Main()
Print "10 minus 4 is:", 10 - 4
End Sub
Negation Syntax
-n
Negation Example
Sub Main()
Print "negated 99 is:", -99
Print "negated -99 is:", -(-99)
End Sub
/
Divides two numbers (n1 and n2), when you want the result expressed as a floating point value.
Syntax
n1 / n2
n1 and n2 can be any valid numeric expressions.
Example
Sub Main()
Print"10 divided by 4 is: ", 10/4 'prints 2.5
End Sub
\
Divides two numbers (n1 and n2).
The dividend will be truncated and the result will be expressed as an integer value without a remainder.
Syntax
n1\n2
n1 and n2 can be any valid numeric expressions.
Example
Sub Main()
Print "10 divided by 4 is:", 10\4 'prints 2
End Sub
< (less than)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If e1 is less than e2, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 < e2
Example
If num < 5 Then
Print "The value of 'num' is less than 5"
<= (less than or equal to)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If e1 is less than or equal to e2, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 <= e2
Example
If num <= 5 Then
Print "The value of 'num' is less than or equal to 5"
<> (not equal)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If the values are different, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 <> e2
Example
Sub Main()
Dim num as Integer
num = 5
If num <> 5 Then
Print "The value of 'num' is not equal to 5"
Else
Print "The value of 'num' is equal to 5"
End If
End Sub
=
Compares the values of two expressions (e1 and e2) of the same or similar types.
If the values are the same, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 = e2
Example
Sub Main()
Dim num as Integer
num = 5
If num = 5 Then
Print "The value of 'num' is equal to 5"
> (greater than)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If e1 is greater than e2, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1 > e2
Example
Sub Main()
Dim num as Integer
num = 5
If num > 5 Then
Print "The value of 'num' is greater than 5"
Else
Print "The value of 'num' is less than or equal to 5"
End If
End Sub
>= (greater than or equal to)
Compares the values of two expressions (e1 and e2) of the same or similar types.
If e1 is greater than or equal to e2, TRUE is returned; otherwise, FALSE is returned.
Syntax
e1>= e2
Example
If num >= 5 Then
Print "The value of 'num' is greater than or equal to 5"
AND
Evaluates whether two expressions (e1 and e2) are TRUE.
Both expressions must be TRUE for the AND result to be TRUE.
Syntax
e1 AND e2
Example
Sub Main()
Dim e1 as Integer, e2 as Integer e1 = TRUE: e2 = 5< 34
If e1 AND e2 Then
Print "Both expressions are TRUE"
Else
Print "Neither expression is TRUE"
End If
End Sub
MOD
Returns the remainder from the division of two numbers (n1 and n2), expressed as an integer.
Syntax
n1 MOD n2
n1 and n2 can be any valid numeric expressions.
Example
Sub Main()
Print "The remainder from 10 divided by 4 is:", 10 MOD 4 'prints 2
End Sub
NOT
Evaluates whether an expression (e) is FALSE.
Syntax
NOT e
Example
Sub Main()
Dim e1 as Integer
e1 = TRUE
If NOT e Then
Print "Expression 'e' was FALSE"
'NOT TRUE=FALSE
Else
Print "Expression 'e' was TRUE"
End If
End Sub
OR
Evaluates whether one or both of two expressions (e1 and e2) are TRUE.
Only one of the expressions needs to be TRUE for the OR result to be TRUE.
Syntax
e1 OR e2
Example
Sub Main()
Dim e1 as Integer, e2 as Integer
e1 = TRUE : e2 = 5 < 34
If e1 OR e2 Then
Print "Either one or both expressions are TRUE"
Else
Print "Both e1 and e2 do not evaluate to TRUE"
End If
End Sub
XOR
Evaluates whether only one of two expressions (e1 and e2) is TRUE.
One expression must be TRUE and the other must be FALSE for the XOR result to be TRUE.
Syntax
e1 XOR e2
Example
Sub Main()
Dim e1 as Integer, e2 as Integer
e1 = TRUE: e2 = 5 < 34
If e1 XOR e2 Then
Print "Only one expression, e1 or e2, is TRUE"
Else
Print "Both e1 and e2 are TRUE or Both e1 and e2 are FALSE"
End If
End Sub
^
Raises a number (n1) to the power of a second number (n2).
For example, raising a number to the power of 2 gives the square of the number.
Syntax
n1^n2
Example
Sub Main()
Print "10 squared is:", 10^2
Print "4 cubed is:", 4^3
Print "6.4 to the power of 1.5 is ", 6.4^1.5
End Sub
BASIC variables
Currency
Used for variables that contain monetary data. This data type uses a fixed decimal point and supports up to 15 digits to the left of the decimal and 4 digits to the right.
This is a superior data type for monetary calculations because the Single and Double data types are subject to small rounding errors.
Acceptable values
-922337203685477.5808 to 922337203685477.5807
Date
Used for variables that contain date data in a valid date format such as 1/1/2000 or January 1, 2000, as well as time data.
You can also use numeric data types for dates. If you do this, values to the left of the decimal represent the days from December 30, 1899. Values to the right of the decimal represent time as a fraction of a day (for example, 12:00 PM is represented as .5).
Acceptable values
January 1, 100 to December 31, 9999
DBConnection
Creates a database connection object.
DBConnection has its own set of attributes and methods.
DBStatement
Creates a database statement object.
DBStatement has its own set of attributes and methods.
Double
Used for variables that can contain any numeric value, including fractions and numbers of high decimal precision. This data type is less efficient than the Integer and Long data types, but more flexible.
The Single data type has the same constraints and size limits as Double. You can use these data types interchangeably. FirstClass RAD treats the traditionally smaller Single data type as a Double to support legacy BASIC code.
Acceptable values
-1.79769313486231E308 to 1.79769313486231E308
Email
Creates an email object.
Email has its own set of attributes and methods.
File
Creates a file object.
File has its own set of attributes and methods.
Integer
Used for integer data types. See the Long data type for more information.
Range
-2,147,483,648 to 2,147,483,647
Long
Used for variables that never contain fractions. This data type is smaller and more efficient than numeric data types that can contain fractions.
The integer data type has the same constraints and size limits as Long. You can use these data types interchangeably. FirstClass RAD treats the traditionally smaller Integer data type as a Long to support legacy BASIC code.
Acceptable values
-2,147,483,648 to 2,147,483,647
Single
Used for single data types. See the Double data type for more information
Range
1.7E +/- 308 (15 digits)
String
Used for variables that contain text strings.
By default, string lengths are variable; however, you can enforce a specific length by using a fixed length String variable. Shorter strings are allowed and are not padded. The length limit is only enforced when the string is longer than the limit.
To make a String variable a fixed length, append an asterisk (*) and a whole number, representing the maximum number of characters, to the String keyword. Strings that are longer than the maximum are truncated.
Acceptable values
0 to approximately 65,500 characters
Example
Dim LastName As String * 7
|