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

#1 2012-11-18 18:31:45

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

if/else

Is there a way to have a small if/else loop?  I have

if <this>
bleh
else
if <this>
bleh
else
if <this>
bleh
times 5, and it's impossible to move.  Halp meh!   yikes


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#2 2012-11-18 20:04:54

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: if/else

Firedrake969 wrote:

Is there a way to have a small if/else loop?  I have

if <this>
bleh
else
if <this>
bleh
else
if <this>
bleh
times 5, and it's impossible to move.  Halp meh!   yikes

Create the sepearately, and then add them all together.


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#3 2012-11-18 20:06:06

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: if/else

Firedrake969 wrote:

Is there a way to have a small if/else loop?  I have

if <this>
bleh
else
if <this>
bleh
else
if <this>
bleh
times 5, and it's impossible to move.  Halp meh!   yikes

Not entirely, though I do have a solution that might help you. First, create a variable named whatever you want. Then, break up your ID's so that it looks like this:

set [variable v] to (0)
if <this>
 set [variable v] to (1)
 bleh
else
 if <this>
  set [variable v] to (1)
  bleh
 end
end
if <(variable) = (0)>
 if <this>
  set [variable v] to (1)
  bleh
 else
  if <this>
   set [variable v] to (1)
   bleh
  end
 end
end

I hope that this helps!

Last edited by ErnieParke (2012-11-18 20:08:11)


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer