m (Mathfreak231 moved page Talk:If (), Else (block) to Talk:If () Then, Else (block): 2.0 title)
Line 21: Line 21:
  
 
I'll add it now.<scratchsig>Mathfreak231</scratchsig> Updated 21:48, 2 February 2013 (UTC)
 
I'll add it now.<scratchsig>Mathfreak231</scratchsig> Updated 21:48, 2 February 2013 (UTC)
 +
 +
== Faulty (?) Workaround ==
 +
 +
I believe I have removed this workaround before, but I'm bringing it up hear so we can discuss it (since it appears to have been re-added).
 +
 +
<scratchblocks>
 +
if<condition>
 +
script
 +
end
 +
if<not<condition>>
 +
script
 +
end
 +
</scratchblocks>
 +
 +
This fails to properly simulate an if-else block because the script in the first condition can (and often does) change inputs in the condition itself.  Consider:
 +
 +
if(x > 2)
 +
set x to 0
 +
else
 +
say "hi"
 +
 +
If one were to use the workaround above, BOTH scripts run.

Revision as of 17:26, 18 April 2014

Bad Example Use

The second example use doesn't use the actual block that the article is about.
Mathfreak231 (talk | contribs) 21:40, 18 January 2013 (UTC)

So go change it!
Scimonster (talk | contribs) 20:01, 19 January 2013 (UTC)

New Workaround

UPDATE: This will work, even not at the end of a script:

if <condition>
action goes here
broadcast [continue v]
stop script
end
other action goes here
broadcast [continue v]
when I receive [continue v]
continuation of script

I'll add it now.
Mathfreak231 (talk | contribs) Updated 21:48, 2 February 2013 (UTC)

Faulty (?) Workaround

I believe I have removed this workaround before, but I'm bringing it up hear so we can discuss it (since it appears to have been re-added).

if<condition>
script
end
if<not<condition>>
script
end

This fails to properly simulate an if-else block because the script in the first condition can (and often does) change inputs in the condition itself. Consider:

if(x > 2)

set x to 0

else

say "hi"

If one were to use the workaround above, BOTH scripts run.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.