zetay / blockly

Automatically exported from code.google.com/p/blockly
1 stars 1 forks source link

Need plain "Return" w/o IF #251

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I'd like to say "Return true" from an ELSE clause of an IF statement in a 
function
2. Currently I have to put IF true RETURN true in my ELSE clause, which seems 
silly

Original issue reported on code.google.com by joeor...@gmail.com on 6 Oct 2014 at 1:34

GoogleCodeExporter commented 9 years ago
Adding this block should be easy, just copy the code for the 'if-return' block 
and strip out the 'if' bits.

Blockly won't be creating this as a default block since a lot of academic 
programmers object to having more than one return statement in a function.  The 
if-return blocks are a compromise that allow for guard statements, while 
encouraging the use of a single return at the bottom.

Original comment by neil.fra...@gmail.com on 1 Mar 2015 at 9:03