ID:172372
 
tryleft
usr.left = input("How much left do you want to move?") as num
if(length(usr.left)>10)
usr << "Too much"
goto tryleft

this code should ask you how much left you want to move and if its over 10 then it should say too far and let you input again, BUT i can put stuff like 500 and it accepts it

any help?

(and i'm sry to ask so many questions lately)
The length() proc only measures text, lists, or files. A number would probably be interpretted as text. That would mean you'd be able to get away with any number so long as it has less than 10 digits(ex: 1,000,000,000). Don't use length, just check against the left var itself.
In response to YMIHere (#1)
wow how could i be so stupid that i didn't realise t o do if(left>10)

sorry for wasting everyone's time
Don't use goto.
In response to Garthor (#3)
Garthor wrote:
Don't use goto.

I use goto also in my code. Whats wrong with it?
In response to Turles9000 (#4)
I use goto also in my code. Whats wrong with it?

It's a very bad programming practice that can always be avoided by using loops. Using goto generally leads to spaggetti code which is hard to read and follow.