contents   index   previous   next



Literal strings

 

A literal string in ScriptEase is any array of characters, that is, a string, appearing in source code within double, single, or back quotes. Back quotes are sometimes referred to as back-ticks. The following lines show examples of literal strings in ScriptEase:

 

"dog"                   // literal string (double quote)

'dog'                   // literal string (single quotes)

`dog`                   // literal string (backticks)

{'d','o','g','\0'}      // not a literal string, rather

                        // an array initialization

 

Literal strings have special treatment for certain ScriptEase operations for the following reasons.

 

To protect literal string data from being overwritten accidentally

To reduce confusion for novice programmers who do not think of strings as arrays of bytes

To simplify writing code for common operations, for example, the statement:

 

TestStr == "MYLONGPASSWORD"

 

is simpler than :

 

Clib.strcmp(TestStr, "MYLONGPASSWORD").

 

In general, literal strings adhere to the two following rules.

 

Comparisons are intrinsically handled by Clib.strcmp()

Assignment and passing of literal strings is done by making copies of the literal string


Literal strings and assignments

Literal strings and comparisons

Literal strings and parameters

Literal strings and returns

Literal Strings and switch statements