Discuss Scratch

OmnipotentPotato
Scratcher
1000+ posts

Otherwise If

What exactly is the difference between the if-else system we already have?
jaboyc
Scratcher
100+ posts

Otherwise If

OmnipotentPotato wrote:

What exactly is the difference between the if-else system we already have?
Well, first, it tests the first if <>. If its true, it ignores all the other if else's. If the first <> is false, then it tests the first else ifs <>. If its true, it ignores all the other else ifs but if its false, it goes to the next else if. This keeps repeating until either one of the else ifs are true or it hits the else statement. I hope I answered your question!
HOWING
Scratcher
500+ posts

Otherwise If

Workaround:
if <condition :: operators> then
//Your blocks here
else
if <condition :: operators> then
//Your blocks here
end
end
//Note: Don't put any blocks after the if block in the else
jaboyc
Scratcher
100+ posts

Otherwise If

Bump
popek04
Scratcher
100+ posts

Otherwise If

HOWING wrote:

Also:
if <> then    

else if <> then :: celse // do do that use ":: celse"
You can keep on you post:
else if <> then :: cstart control

end

EDIT: IF this was in 1.4 then There COULD be another block :
forever if <>

else if <>:: celse

end
1. ELSE IF, not OTHERWISE IF

2.
define <1><2>
forever if<1> //Shorter, you can add this block

else if<2>::celse

end

define <1><2>
forever //This block I don't want to do
if <1>

else
if <2>

end
end

Last edited by popek04 (Sept. 26, 2014 15:11:39)

popek04
Scratcher
100+ posts

Otherwise If

HOWING wrote:

Workaround:
if <condition :: operators> then
//Your blocks here
else
if <condition :: operators> then
//Your blocks here
end
end
//Note: Don't put any blocks after the if block in the else
...//Use this block
Frenzar
Scratcher
100+ posts

Otherwise If

TimothyLawyer wrote:

Thepuzzlegame wrote:

Just do this:
if <> then

else
if <> then

else
if <> then

else

end
end
end
Think_Quest
New Scratcher
14 posts

Otherwise If

Support, because elseif exists (in other programming languages) for a reason. If it weren't a big deal nesting then elseif wouldn't exist, though I guess some ppl don't mind. I personally will go nuts if there are too many if/else. I guess it varies from person to person.
RPFluffy
Scratcher
1000+ posts

Otherwise If

HOWING wrote:

Also:
if <> then    

else if <> then :: celse // do do that use ":: celse"
You can keep on you post:
else if <> then :: cstart control

end

EDIT: IF this was in 1.4 then There COULD be another block :
forever if <>

else if <>:: celse

end

The forever if workaround is easy, it's this (surprisingly!):
if <> then
forever

end


end

But for the if and constant else, sure!
Maybe you could right click the else part and it would say “add else” and then it would add another else?
stickfiregames
Scratcher
1000+ posts

Otherwise If

RPFluffy wrote:

HOWING wrote:

Also:
if <> then    

else if <> then :: celse // do do that use ":: celse"
You can keep on you post:
else if <> then :: cstart control

end

EDIT: IF this was in 1.4 then There COULD be another block :
forever if <>

else if <>:: celse

end

The forever if workaround is easy, it's this (surprisingly!):
if <> then
forever

end


end

But for the if and constant else, sure!
Maybe you could right click the else part and it would say “add else” and then it would add another else?
Actually it is
forever
if <> then
end
end
and that is why it was removed - no-one could remember which way round it was.
RPFluffy
Scratcher
1000+ posts

Otherwise If

stickfiregames wrote:

RPFluffy wrote:

HOWING wrote:

Also:
if <> then    

else if <> then :: celse // do do that use ":: celse"
You can keep on you post:
else if <> then :: cstart control

end

EDIT: IF this was in 1.4 then There COULD be another block :
forever if <>

else if <>:: celse

end

The forever if workaround is easy, it's this (surprisingly!):
if <> then
forever

end


end

But for the if and constant else, sure!
Maybe you could right click the else part and it would say “add else” and then it would add another else?
Actually it is
forever
if <> then
end
end
and that is why it was removed - no-one could remember which way round it was.

Actually think about it, it would go on forever if this happened, so actually:

if <> then
forever

end


end
stickfiregames
Scratcher
1000+ posts

Otherwise If

RPFluffy wrote:

Actually think about it, it would go on forever if this happened, so actually:

if <> then
forever

end


end
It is meant to go on forever. Open up 1.4 and try it.

Last edited by stickfiregames (Nov. 13, 2014 07:33:15)

Powered by DjangoBB