MAINSAIL Language Manual, Section 46.5

previous   next   top   contents   index   framed top   this page unframed


46.5. rcRead

Figure 46–5. rcRead
$BUILTIN
INTEGER
PROCEDURE   rcRead      (MODIFIES STRING s);

rcRead (“reverse cRead”) returns the character code of the last character of the STRING s, and then removes that character from the STRING.

If s is the empty STRING, -1 is returned. -1 is not a valid character code.

Example 46–6. Use of rcRead
INTEGER tSTRING s;
s := "abc";
t := rcRead(s);
    # 
Now t = 'c', s = "ab"

...

STRING PROCEDURE reverse (STRING s);
BEGIN # reverse characters of s
STRING r;
r := "";
WHILE s DO cWrite(r,rcRead(s));
RETURN(rEND


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 46.5