This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-11-01 03:37:58

emma147
New Scratcher
Registered: 2011-11-01
Posts: 4

Not letting my variable be a letter

I'm completing a scratch programme that 'draws straws' for a task (allocating a task to someone). At the moment I'm trying not to let the user input letters but I can't find an effective way to do it. Any Ideas?

Thanks  smile

Offline

 

#2 2011-11-01 03:50:07

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: Not letting my variable be a letter

Use the ask button, check its length to make sure it's just one letter using the length of () block. To keep the letter safe, store it in a variable with set variable to (answer).

Does that help?  smile


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#3 2011-11-01 04:00:41

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Not letting my variable be a letter

I think this'll work:
Repeat until answer squared = answer squared
Ask please enter a number

Obviously if it's a number it will work, but I think if there's a letter in it it will ask it again.


Why

Offline

 

#4 2011-11-01 04:14:46

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Not letting my variable be a letter

What you want is all explained heresmile

Offline

 

Board footer