
-----------------------------------
l0tt0
Thu Oct 23, 2003 4:52 pm

Get Value Certain Length
-----------------------------------
Is there anyway taht when you use
get variable 
that it can only be a certain amount of characters?

Say I have a yes or no question i just want them to enter y or n...

anyone? thanks in advance

-----------------------------------
Tony
Thu Oct 23, 2003 5:09 pm


-----------------------------------

var letter:string(1) %= 32 and ord (ch) = 1 then % if it is backspace
            tempWord := word
            word := ""
            locate (whatrow, whatcol - 1)
            put " " ..
            locate (whatrow, whatcol - 1)
            for q : 1 .. length (tempWord) - 1
                word += tempWord (q)
            end for
        end if
        exit when ord (ch) = 10 or length (word) = wordLength
    end loop
    put ""
    result word
end getWord

var someString : string
someString := getWord (5)
put someString


-----------------------------------
hackman
Mon Oct 27, 2003 11:45 am


-----------------------------------
Not realy relavent but...what dose ch in getch stand for?

-----------------------------------
Tony
Mon Oct 27, 2003 6:11 pm


-----------------------------------
should have read the whole code first :roll:

var ch : string (1) 


ch is a name of a variable of string(1) type

-----------------------------------
hackman
Tue Oct 28, 2003 11:46 am


-----------------------------------
i meant in the getch comand, as in

var ans:string (1)
getch (ans)

-----------------------------------
Tony
Tue Oct 28, 2003 5:33 pm


-----------------------------------
ohhh :roll: lol :lol:

ch in "getch" is short for character.

-----------------------------------
hackman
Wed Oct 29, 2003 10:51 am


-----------------------------------
:D wohoo my guese was right!
