Discuss Scratch
- theonlygusti
-
Scratcher
1000+ posts
Return Block
This is already a planned, and pretty much implemented, feature of Scratch.
- Zro716
-
Scratcher
1000+ posts
Return Block
yES!! YESS!!! ALL MY SUPPORT!!!!!!!exclamation!!!!one!
and I know exactly how this should work. seeing how blocks should be self-explanatory, I'll make sure to show an example that is easy to understand how everything will work. hopefully the ST will revisit this topic and see this post (
). so off to the races…
let's start with creating a normal custom block:
so now to finish the script:

and I know exactly how this should work. seeing how blocks should be self-explanatory, I'll make sure to show an example that is easy to understand how everything will work. hopefully the ST will revisit this topic and see this post (
). so off to the races…let's start with creating a normal custom block:
New Blockbelow the checkbox for screen refresh is the checkbox for returning a value. when checked…base (2) to the power of (5) ::custom▼Options
Add number input:
Add string input:
Add boolean input:
Add label text:
☑Run without screen refresh
□Return a value
New Block…the custom block becomes a custom reporter. and the definition block for it looks like this now:(base (2) to the power of (5) ::custom)▼Options
Add number input:
Add string input:
Add boolean input:
Add label text:
☑ Run without screen refresh
☑ Return a value
(base (base ::custom) to the power of (power ::custom) ::custom) {return [] ::custom cap} ::custom hat
//it's supposed to be a definition block but "define" would make it parse wrongnot only does the appearance of the custom block nested in the procedure hat block look like a round operator, it also comes with a reporter cap block that you can drag into the script anywhere like a normal argument. if no return block is in the script the custom operator returns nothing.so now to finish the script:
when gf clickedI don't think this poses any ambiguities since the blocks explain themselves pretty well!
ask [base] and wait
set [Base v] to (answer)
ask [exponent] and wait
set [Exponent v] to (answer)
set [Result v] to (base (Base) to the power of (Exponent) ::custom)
say (join [The result is ](Result))
(base (base ::custom) to the power of (power ::custom) ::custom) {return [] ::custom cap} ::custom hat
return ([10^ v] of (([log v] of (base ::custom)) * (power ::custom))) ::custom cap

- stickfiregames
-
Scratcher
1000+ posts
Return Block
I don't think this poses any ambiguities since the blocks explain themselves pretty well!What if there is no return at the end?
Maybe it should be a combined hat / c block:
dеfine ((base ::custom-arg) ^ (power :: custom-arg) :: custom) :: custom hatThat would force it to reach a return.
:: custom cstart
{return [] :: custom cap} :: custom cend
Last edited by stickfiregames (Oct. 9, 2014 16:37:04)
- theonlygusti
-
Scratcher
1000+ posts
Return Block
could have done:I don't think this poses any ambiguities since the blocks explain themselves pretty well!What if there is no return at the end?
Maybe it should be a c block:dеfine (() ^ () :: custom) :: custom hatThat would force it to reach a return.
:: custom cstart
{return [] :: custom cap} :: custom cend
deƒine (() ^ () :: custom) :: custom hat
:: custom cstart
return [] :: cend
Last edited by theonlygusti (Oct. 8, 2014 15:52:30)
- TimothyLawyer
-
Scratcher
1000+ posts
Return Block
A problem with just being able to check and un-check a box to switch between stack and operator style blocks is:
It could be confusing.
Maybe the checkbox would not work unless the block is not yet used in the project, or until all instances of the block were deleted from the project?
Or no checkbox at all. Just when a
- What if the Scratcher already has the other kind of block in their project?
- What happens to those blocks?
It could be confusing.
Maybe the checkbox would not work unless the block is not yet used in the project, or until all instances of the block were deleted from the project?
Or no checkbox at all. Just when a
return [] :: custom capis added to
definestack, if the custom block is already being used in the project, a dialog box comes up to let you know you need to delete all instances of the stack-style block before the 'return' block can be added the custom block outline changes from stack to operator (or vice versa).
- stickfire-helper
-
Scratcher
24 posts
Return Block
But that doesn't look the same.could have done:I don't think this poses any ambiguities since the blocks explain themselves pretty well!What if there is no return at the end?
Maybe it should be a c block:dеfine (() ^ () :: custom) :: custom hatThat would force it to reach a return.
:: custom cstart
{return [] :: custom cap} :: custom cenddeƒine (() ^ () :: custom) :: custom hat
:: custom cstart
return [] :: cend
- stickfiregames
-
Scratcher
1000+ posts
Return Block
could have done:That doesn't look the same though.deƒine (() ^ () :: custom) :: custom hat
:: custom cstart
return [] :: cend
- Zro716
-
Scratcher
1000+ posts
Return Block
read the rest of the post. I already said if there wasn't a return block it would return nothing.I don't think this poses any ambiguities since the blocks explain themselves pretty well!What if there is no return at the end?
- angrybird232
-
Scratcher
100+ posts
Return Block
Snap is a big lie about adding inputs and outputs to your blocks. Use BLOCKLY!!!!!!!!! Only blockly is possible to do EVERYTHING! I tried scratch,snap,and blockly and blockly only worked!I think Snap!'s way is better.I think custom report blocks are planned for 2.1.
Until then, you can always use Snap!.
I know, just I like scratch and as far as I know they were planning to add a return block like Snap! does and I think my way is better.Why? Your way, there's only one possible return value. With a return () block, you can make a block like (what type is ) and have it report number, string, boolean, etc. Or you could have an error message…
But it's true that your way is a bit more intuitive.
Last edited by angrybird232 (Dec. 13, 2014 04:01:22)
- angrybird232
-
Scratcher
100+ posts
Return Block
Only possible on blockly.But that doesn't look the same.could have done:I don't think this poses any ambiguities since the blocks explain themselves pretty well!What if there is no return at the end?
Maybe it should be a c block:dеfine (() ^ () :: custom) :: custom hatThat would force it to reach a return.
:: custom cstart
{return [] :: custom cap} :: custom cenddeƒine (() ^ () :: custom) :: custom hat
:: custom cstart
return [] :: cend
- Zro716
-
Scratcher
1000+ posts
Return Block
I don't think you've used snap to its full potential.Snap is a big lie about adding inputs and outputs to your blocks. Use BLOCKLY!!!!!!!!! Only blockly is possible to do EVERYTHING! I tried scratch,snap,and blockly and blockly only worked!I think Snap!'s way is better.I think custom report blocks are planned for 2.1.
Until then, you can always use Snap!.
I know, just I like scratch and as far as I know they were planning to add a return block like Snap! does and I think my way is better.Why? Your way, there's only one possible return value. With a return () block, you can make a block like (what type is ) and have it report number, string, boolean, etc. Or you could have an error message…
But it's true that your way is a bit more intuitive.
- angrybird232
-
Scratcher
100+ posts
Return Block
define return [string 1][scratchblocks]
deleted return
- Scratcher1002
-
Scratcher
1000+ posts
Return Block
Wait, shouldn't this be another block?
receive from [ v] and put in variable [ v] :: custom+1
Last edited by Scratcher1002 (Dec. 16, 2014 01:36:01)
- Cyoce
-
Scratcher
500+ posts
Return Block
It should say “make a reporter”

Also, I don’t understand why people put a return in the end of the c-block. Additionally, “return ( )” should be found under “more blocks”, not be clicking on a (+) sign that has not been programmed into Scratch.
…Lol you spelled “mistakes” as “misteakes”. Mistake on a mistake.
https://dl.dropboxusercontent.com/u/17754076/Scratch/Make%20a%20block%205.png
…

Also, I don’t understand why people put a return in the end of the c-block. Additionally, “return ( )” should be found under “more blocks”, not be clicking on a (+) sign that has not been programmed into Scratch.
Last edited by Cyoce (Dec. 16, 2014 02:05:57)
- cwrivera99
-
Scratcher
500+ posts
Return Block
You obiviously did not look at the images, because that is not at all what he is talking about.For some reason, this wouldn't let me post images, even if I used imageshack.com. Here is a link to this same thing but with images:You already can. Right-click on a custom block, click “edit”, and there are string, number, and boolean inputs.
https://dl.dropboxusercontent.com/u/17754076/Scratch/Return%20block.html
Return Block
My idea is that instead of there being a return block implemented so users could make the equivalent of an “int” or “String” function rather than the usual “void”, but instead that the “make a block” tab also had a “make a block (with return)”.
Image: https://dl.dropboxusercontent.com/u/17754076/Scratch/Make%20a%20block.png
The user would then have a the usual “make a block” input interface.
When defining the block, it would look something like this:
Image: https://dl.dropboxusercontent.com/u/17754076/Scratch/Make%20a%20block%202.png
Finally, the last step would be using the block:
Image: https://dl.dropboxusercontent.com/u/17754076/Scratch/Make%20a%20block%203.png
Image: https://dl.dropboxusercontent.com/u/17754076/Scratch/Make%20a%20block%204.png
It seems that this thread has reached a conclusion. TM_ has created a project to explain it. http://scratch.mit.edu/projects/11829884/I support this.
My original post:For some reason, this wouldn't let me post images, even if I used imageshack.com. Here is a link to this same thing but with images:
https://dl.dropboxusercontent.com/u/17754076/Scratch/Return%20block.html
Return Block
My idea is that instead of there being a return block implemented so users could make the equivalent of an “int” or “String” function rather than the usual “void”, but instead that the “make a block” tab also had a “make a block (with return)”.
Image: https://dl.dropboxusercontent.com/u/17754076/Scratch/Make%20a%20block.png
The user would then have a the usual “make a block” input interface.
When defining the block, it would look something like this:
Image: https://dl.dropboxusercontent.com/u/17754076/Scratch/Make%20a%20block%202.png
Finally, the last step would be using the block:
Image: https://dl.dropboxusercontent.com/u/17754076/Scratch/Make%20a%20block%203.png
Image: https://dl.dropboxusercontent.com/u/17754076/Scratch/Make%20a%20block%204.png
- da-ultimate-creater
-
Scratcher
100+ posts
Return Block
Support if we had the ability to make custom reporters/booleans. Otherwise it would be kind of useless.
Maybe the return block could look like this:
I just realized how old this topic is
Maybe the return block could look like this:
return () :: control cap
I just realized how old this topic is










Why? Your way, there's only one possible return value. With a return () block, you can make a block like (what type is ) and have it report number, string, boolean, etc. Or you could have an error message…






