LoginLogin

Name typing

Root / Programming Questions / [.]

🔒
thatguyCreated:
How can you make it so if name$ equale or is bigger the 7 letters/numbers goto @loop ?

if you mean checking the length of a string name$, use LEN(). It takes a string as an argument and will return the length in characters.
INPUT "Name?",name$
?"Your name is ";LEN(name$);" characters long."

No i mean that i want to set a max number of 6 charcters by the typing proces of the name.

If you want to set a max of six, you could just do LEFT$(name$,6) I'm pretty sure. This would trim any extra characters. If you want to be nice and re-ask them for their name...
@TOOLONG
INPUT "Name?",name$
IF LEN(name$)>6 THEN @TOOLONG
Which will check IF the name was greater than six characters in length. It translates pretty well to code, actually.

Thanks!