JBasic Userʼs Guide
Both the SAVE WORKSPACE and LOAD commands allow you to specify a different workspace name than the default, if you wish to create more than one workspace. You might do this to maintain separate versions of your program, or to group programs by projects or other related activity. Note that you can save individual programs (similar to the way other BASIC dialects work) by using the SAVE command, which is different than SAVE WORKSPACE and saves only the current program to a text file. The LOAD command can be used to read in either individual programs or workspaces interchangeably. If the filename given in a SAVE WORKSPACE, SAVE, or LOAD command does not have an extension, then “.jbasic” is assumed.
Constants JBasic supports a wide variety of data types. Most are referred to as “scalar” types, which means they contain a single value of a given type, such as an integer or a string. Some data types are “compound” and are used to hold things like lists of values, and are discussed later. This section describes the most fundamental scalar data types and how to enter values for each type. The table below indicates the basic data types supported by JBasic: Type
Example
Description
BOOLEAN
true, false
A value that can contain only the values true or false.
INTEGER
55, -108
An integer value with an optional sign, but no fractional component.
DOUBLE
-3.8, 1.2E-8
A floating point value that can have a whole number and a fractional component. The number can be expressed in exponential notation as well, with a power-of-10 multiplier as shown in the second example, which is the same as 0.0000000012.
STRING
“Score:\t103”
A string containing zero or more characters. The string can contain control characters when “escaped” with the back-slash character. The example string has a tab character between the colon and the digit “1”.
As shown in the example for a string, a string constant can include representations of characters such as the \t for a tab character. The table below shows the characters that can be represented in a string this way:
Value
Name
\t
tab
\”
quote
\n
newline
\\
backslash
Example “The total is:\t103” “The word \”franchise\” is what you seek.” “First line\nsecond line” “The backslash \\ is used for control characters.
13