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

#1 2012-05-24 21:05:33

sanjayraj
Scratcher
Registered: 2012-03-25
Posts: 500+

Integer or not?

Hi
I am trying to make a project where you give them a number and then they tell you weather it's an integer or not. I know this much:

when gf clicked
ask [Give me a number!] and wait
Then what do you do?


http://i46.tinypic.com/23sw40j.png

Offline

 

#2 2012-05-24 21:10:37

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Integer or not?

You could do something like this:

when gf clicked
ask [Give me a number!] and wait
if <(round (answer)) = (answer)>
say [That's an integer!] for (2) secs
else
say [That's not an integer...] for (2) secs


http://i.imgur.com/WBkM2QQ.png

Offline

 

#3 2012-05-24 21:23:39

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Integer or not?

Lucario621 wrote:

You could do something like this:

when gf clicked
ask [Give me a number!] and wait
if <(round (answer)) = (answer)>
say [That's an integer!] for (2) secs
else
say [That's not an integer...] for (2) secs

This works.

Offline

 

#4 2012-05-24 21:33:36

sanjayraj
Scratcher
Registered: 2012-03-25
Posts: 500+

Re: Integer or not?

Thanks! It worked!


http://i46.tinypic.com/23sw40j.png

Offline

 

Board footer