
-----------------------------------
mike200015
Mon Feb 21, 2005 3:02 pm

String Limit
-----------------------------------
is there a way to limit the amount of letters that will be output? I know you can do:  var x :string (6) which will only allow an input of at most 6 letters, but then when more than 6 letters are input then it screws up the game by exitting and going to the code. Is there a way to allow as many letters to be input, but then it will only output the 1st 6 letters?

-----------------------------------
Flikerator
Mon Feb 21, 2005 3:20 pm


-----------------------------------
var word : string
get word
if length (word) =< 6 then
    word := word
else
    word := ""
end if

Or if you want to keep asking for the word till you get it;

var word : string

loop
    get word
    exit when length (word) 