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

#1 2010-10-15 01:40:20

colemagoo
New Scratcher
Registered: 2010-10-15
Posts: 8

Variable IF testing

Hey, kinda a noob question,

Is there any way to use an IF block to test the value of a variable?

So, in a practical example,

IF (Variable=1)
do stuff here...

ELSE
  do other stuff here

Is there any way to do this, that I am missing, or are there any other viable alternatives? Any help appreciated.

Offline

 

#2 2010-10-15 02:36:14

2l84zwamani
Scratcher
Registered: 2010-09-27
Posts: 100+

Re: Variable IF testing

HELLO BELLO EVEWEEBUHDDY.

This is how you do it:

<when green flag clicked>
<forever>
<if><( Name of variable <=>  1)>
do whatever

<end>

... Or at least I hope so. Anyway, the blocks in the posts are confusing and I can only post every 10 minutes, so if I get it wrong ... yeah.
___________________________(signature number 1)
YAY I HAVE 2 SIGNATURES NOW!


I will be a Ms. Pickle Dr. Deadpebble Great Person <forever>
http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3 GROB THE SLIME WILL TAKE OVER THE WORLD!

Offline

 

#3 2010-10-15 02:46:35

2l84zwamani
Scratcher
Registered: 2010-09-27
Posts: 100+

Re: Variable IF testing

You can find the "blahblah=1" block in Operators (or in 1.3 it's called Numbers).

Anyway, if you've said "Thanks" or something by the time this has been posted, "You're welcome". And if you need anything else I might reply in 20 minutes, I want to reply to another post and then if somebody else hasn't already answered your questions I probably will reply.

Ohkay?


I will be a Ms. Pickle Dr. Deadpebble Great Person <forever>
http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3http://is.gd/d55N3 GROB THE SLIME WILL TAKE OVER THE WORLD!

Offline

 

#4 2010-10-15 05:58:03

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Variable IF testing

2l84zwamani got it.  smile  One more thing: the "if" blocks are in the Control blocks section. And of course, only use the forever block if you need it to check infinitely. Otherwise, put the "if" wherever you need it in your scripts.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#5 2010-10-16 01:22:44

colemagoo
New Scratcher
Registered: 2010-10-15
Posts: 8

Re: Variable IF testing

Sorry, noticed the forever block, like 10 seconds after I posted  smile

Offline

 

Board footer