if not get?
Author |
Message |
aldreneo
|
Posted: Wed Jun 21, 2006 5:25 pm Post subject: if not get? |
|
|
How do I do
code: |
var oo:real
if not get oo then
put "Error: ", Error.LastMsg
end if
|
So that if the user puts a letter insted of a number it doesnt die? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Wed Jun 21, 2006 6:20 pm Post subject: (No subject) |
|
|
i believe there is a function that determines whether input is of the right type, i think it is something like strintok or something to that effect:D |
|
|
|
|
![](images/spacer.gif) |
TheOneTrueGod
![](http://www.drmcninja.com/images/mcninjab3.jpg)
|
Posted: Wed Jun 21, 2006 6:37 pm Post subject: (No subject) |
|
|
aye, look in the Turing Help (f10) for
strrealok
strintok
strreal
and
strint
Keep in mind you will need a second variable that is a string, and then you'll need to convert it. If you keep this in a separate procedure, It won't clutter up your code. |
|
|
|
|
![](images/spacer.gif) |
aldreneo
|
Posted: Wed Jun 21, 2006 7:15 pm Post subject: (No subject) |
|
|
Ok, I got it
code: |
var number:real
var letter:string
get letter
if strintok(letter)=false then put "error" else number:=strreal(letter)
|
Thanks |
|
|
|
|
![](images/spacer.gif) |
|
|