Discuss Scratch
- SavetheAtlantic
-
Scratcher
1000+ posts
Add an Arrow Function and Operator.
no, you put two variables into it, and merges their properties (I think)What do you mean by “I think”? Do you not even know what your own suggestion does?
Last edited by SavetheAtlantic (Dec. 7, 2022 15:50:08)
- cookieclickerer33
-
Scratcher
1000+ posts
Add an Arrow Function and Operator.
You don’t even know what it does???no, you put two variables into it, and merges their properties (I think)like you dont need to create a whole new variable, if they have an arrow block you can put something in there to temporarily hold data (though i dont know the differences between the different arrows)I still don’t get itwhat he means is you don't have to have a variable to hold data, it can look back to a previous part of the code to get a value.finally an actual explanation
edit: at least I think
Is this just script variables?
Then why are you suggesting it?
- Frenzyboyz33
-
Scratcher
100+ posts
Add an Arrow Function and Operator.
it's the arrow function, I'm not clear about it, THATS IT.You don’t even know what it does???no, you put two variables into it, and merges their properties (and stuff)like you dont need to create a whole new variable, if they have an arrow block you can put something in there to temporarily hold data (though i dont know the differences between the different arrows)I still don’t get itwhat he means is you don't have to have a variable to hold data, it can look back to a previous part of the code to get a value.finally an actual explanation
edit: at least I think
Is this just script variables?
Then why are you suggesting it?
I still want it for other users too, like @Griffpatch
Last edited by Frenzyboyz33 (Dec. 8, 2022 18:54:31)
- Frenzyboyz33
-
Scratcher
100+ posts
Add an Arrow Function and Operator.
These look nothing like arrow functions to me. What do they do, compared to normal actual JS arrow functions?they work the same way. the output attached is for when you use it as a value, since it would useless otherwise
- cookieclickerer33
-
Scratcher
1000+ posts
Add an Arrow Function and Operator.
Then what’s the use for itit's the arrow function, I'm not clear about it, THATS IT.You don’t even know what it does???no, you put two variables into it, and merges their properties (and stuff)like you dont need to create a whole new variable, if they have an arrow block you can put something in there to temporarily hold data (though i dont know the differences between the different arrows)I still don’t get itwhat he means is you don't have to have a variable to hold data, it can look back to a previous part of the code to get a value.finally an actual explanation
edit: at least I think
Is this just script variables?
Then why are you suggesting it?
I still want it for other users too, like @Griffpatch
- qwerty_wasd_gone
-
Scratcher
1000+ posts
Add an Arrow Function and Operator.
when green flag clicked
set [my variable v] to [hello]
say (my variable)
- Jonathan50
-
Scratcher
1000+ posts
Add an Arrow Function and Operator.
In this example of yours,
Judging by the fact that it's based on JavaScript's arrow function, maybe it's meant to define a local custom reporter block, like
it would presumably say “hello”. But it isn't really clear what “my variable” is doing there, or how it's different from
(since it seems to be more than just a local variable called “a”)when green flag clicked
set [my variable v] to [hello]
say (my variable)
Judging by the fact that it's based on JavaScript's arrow function, maybe it's meant to define a local custom reporter block, like
when gf clickedwhich in Snap! would be
arrow (x) ⇨ ((x) * (x)) (square () :: operators) :: operators
say (square (3) :: operators) for (2) secs // 9
say (square (4) :: operators) for (2) secs // 16
when gf clickedso you might need to explain a bit more clearly if you have an idea what you want.
script variables (square) @delInput @addInput :: grey
set [square v] to (((x) * (x)) input names: (x) @delInput @addInput :: grey ring)
say (call (square) with inputs [3] @delInput @addInput :: control) for (2) secs
say (call (square) with inputs [4] @delInput @addInput :: control) for (2) secs
- Creator-H
-
Scratcher
100+ posts
Add an Arrow Function and Operator.
Wdym by merge? I thought I understood it, but…no, you put two variables into it, and merges their properties (and stuff)like you dont need to create a whole new variable, if they have an arrow block you can put something in there to temporarily hold data (though i dont know the differences between the different arrows)I still don’t get itwhat he means is you don't have to have a variable to hold data, it can look back to a previous part of the code to get a value.finally an actual explanation
edit: at least I think
Is this just script variables?
- yavuz61035
-
Scratcher
500+ posts
Add an Arrow Function and Operator.
maybe they could be merged into one block?it should be merged into -> to avoid clutter
does having 2 blocks that do the same thing except looking different make sense
- Frenzyboyz33
-
Scratcher
100+ posts
Add an Arrow Function and Operator.
In this example of yours,exactly!it would presumably say “hello”. But it isn't really clear what “my variable” is doing there, or how it's different from(since it seems to be more than just a local variable called “a”)when green flag clicked
set [my variable v] to [hello]
say (my variable)
Judging by the fact that it's based on JavaScript's arrow function, maybe it's meant to define a local custom reporter block, likewhen gf clickedwhich in Snap! would be
arrow (x) ⇨ ((x) * (x)) (square () :: operators) :: operators
say (square (3) :: operators) for (2) secs // 9
say (square (4) :: operators) for (2) secs // 16when gf clickedso you might need to explain a bit more clearly if you have an idea what you want.
script variables (square) @delInput @addInput :: grey
set [square v] to (((x) * (x)) input names: (x) @delInput @addInput :: grey ring)
say (call (square) with inputs [3] @delInput @addInput :: control) for (2) secs
say (call (square) with inputs [4] @delInput @addInput :: control) for (2) secs
- CST1229
-
Scratcher
1000+ posts
Add an Arrow Function and Operator.
(#7)So basically a “reusable function” block, something like the below?when green flag clicked
Arrow (... :: functions) <...> ➜ <arrowValue :: operators> :: operators
say<arrowValue :: operators>
simplified version
when flag clicked
reporter ((1) + (timer)) as (block :: operators) :: operators
say (block :: operators) // 1
wait (1) seconds :: control
say (block :: operators) // ~2
Last edited by CST1229 (Dec. 12, 2022 13:44:56)
- 7salad3salad
-
Scratcher
1000+ posts
Add an Arrow Function and Operator.
basically a custom reporterwhich is what a variable is??
- bbrainstormer
-
Scratcher
11 posts
Add an Arrow Function and Operator.
look here then.there also isn't a workaround, and this would be very usefulWhat does it do still, I don’t Understand
https://www.w3schools.com/js/js_arrow_function.asp
Interesting idea, but could be worded much better. I shouldn't have to read through the comments to understand your idea.
Last edited by bbrainstormer (Dec. 12, 2022 17:44:18)
- banana439monkey
-
Scratcher
1000+ posts
Add an Arrow Function and Operator.
with all due respect
i actually want to gouge my eyes out
arrows are not it lol
also why is “my variable” necessary in this context?
that said i'd be happy for something similar to:
which would be way better than
but even if i want to gouge my eyes out, i understand that scratch's primary demographic will not understand the async/await style of js, so i guess i might well be willing to accept having both blocks available to me
Banana
i actually want to gouge my eyes out
arrows are not it lol
also why is “my variable” necessary in this context?
that said i'd be happy for something similar to:
let a = arrow("hello") say(a)
set [a v] to (arrow [hello] :: custom)
say (a)
which would be way better than
arrow("hello").then(a => { say(a) });
arrow [hello] then with returned value as (a :: custom) {
say (a :: custom)
} :: custombut even if i want to gouge my eyes out, i understand that scratch's primary demographic will not understand the async/await style of js, so i guess i might well be willing to accept having both blocks available to me
Banana













