Some Restrictions about
Working with Text Strings
As you probably already know, SiMPLE offers five different data types: Int, Int2, Float, Float2, and Text. Of these five, the Text data type requires some special attention since it is the only one that deals with non-numerical quantities.
Concatenation
As is pointed out in the SiMPLE tutorials:
Because of the unique way in which SiMPLE handles text strings,
the concatenation operation will not work as part of a task's (or
function's) calling parameters. For example, the program:
name = Keyin text ("Enter your name: ")
Output ("Your name is " + name)
will not compile. However, the program:
name = Keyin text ("Enter your name: ")
message = "Your name is " + name
Output (message)
will compile properly.
In addition, the keyword "Set" will sometimes not work with concatination statements. For example, the statement:
Set a = "SiM" + "PLE"will not compile. However, the statement:
a = "SiM" + "PLE"will compile properly.
On the other hand, the statement:
a = "SiM" "PLE"will not compile. But the statement:
Output ("SiM" "PLE")will compile properly! (It will display the word: SiMPLE )
Also, the program:
name = "Robert"
So, it is possible to concatinate two or more strings when used as a task's (or function's) calling
Initializing a Text Array
Unlike with the numerical data types (Int, Int2, Float, and Float2), a text array can be initialized only in a Common
statement. For example, the following statement:
will generate an error message. But the statement:
Text a[3] = {"AB", "CD", "EF"}
will compile correctly.
Common Text a[3] = {"AB", "CD", "EF"}
(All of these restrictions are due to irreparable bugs in the SiMPLE compiler.)
[
Webmaster |
FAQ's |
Home Page |
Contact Us ]