int e l CHAPTER 6 Description of String Operators 6.1 WHAT ARE STRINGS ? A string is a character or a bunch of characters that are stored in memory. Usually, the characters stored in a string make up a word or a sentence. Strings are handy because they allow the programmer to deal with words instead of numbers. This is useful because it allows one to write "friendly" programs, where individuals can be referred to by their names instead of a number. MCS BASIC-52 contains ONE dimensioned string variable, $([expr]). The dimension of the string variable (the [expr] value) ranges from 0 to 254. This means that 255 different strings can be defined and manipulated in MCS BASIC-52.
Initially, NO memory is allocated for strings. Memory is allocated by the STRING [expr], [expr] STATEMENT. The details of this statement are covered in the DESCRIPTION OF STATEMENTS chapter of this manual. In MCS BASIC-52, strings can be defined in two ways, with the LET STATEMENT and with the INPUT STATEMENT. EXAMPLE: >10 STRING 100,20 >20 $(1)="THIS IS A STRING, " >30 INPUT "WHAT'S YOUR NAME? - ",$(2) >40 PRINT $(1),$(2) >RUN WHAT'S YOUR NAME?. - FRED THIS IS A STRING, FRED STRINGS can also be assigned to each other with a LET statement. EXAMPLE: $(2)=$(1) Would assign the STRING value in $(1) to the STRING $(2). - 82 -