Discuss Scratch
- Discussion Forums
- » Suggestions
- » "if () then () else ()" control block.
- HTML_JAVASCRIPT_CSS
-
100+ posts
"if () then () else ()" control block.
The tenary operator? idk
it would seem kinda cool
it's built into javascript and probably wouldn't be very hard to implement ()some_boolean?"the boolean is true":"the boolean is false"
maybe it could be like this(if <some condition::operators> then [value 1] otherwise [value 2]::operators)
ik it would be confusing to new scratchers but they wouldnt even need to touch it
it's just a convenient shorthand
- MDCCCLXVII
-
1000+ posts
"if () then () else ()" control block.
Another merged suggestion, another duplicate.
Don't block-spam, even in duplicate topics.if <In Good Mood> then
Imagine :pink:
else
end
Last edited by MDCCCLXVII (Dec. 22, 2020 01:27:59)
- MDCCCLXVII
-
1000+ posts
"if () then () else ()" control block.
time to bump a non-duplicate
get this now
get this now
Last edited by MDCCCLXVII (March 13, 2021 01:00:28)
- han614698
-
1000+ posts
"if () then () else ()" control block.
Please don't bump a dupe. time to bump
- lordibel
-
1000+ posts
"if () then () else ()" control block.
bruh… please stop blockspamming
- Scratchperson1000000
-
500+ posts
"if () then () else ()" control block.
actually, now that I think about it, it COULD be useful, for example:
define factorial (n)to me, this workaround doesn't really matter anymore!:
set [factorial v] to (if <(n) = (0)> then (1) else ((n) * ((n) - (1))) mod ((n) - (1)) :: operators)
if <> thennow that i've changed my mind. i say support.
else
- MDCCCLXVII
-
1000+ posts
"if () then () else ()" control block.
to make this work you need custom reporters as welldefine factorial (n)
set [factorial v] to (if <(n) = (0)> then (1) else ((n) * ((n) - (1))) mod ((n) - (1)) :: operators)
- Scratchperson1000000
-
500+ posts
"if () then () else ()" control block.
No you don'tto make this work you need custom reporters as welldefine factorial (n)
set [factorial v] to (if <(n) = (0)> then (1) else ((n) * ((n) - (1))) mod ((n) - (1)) :: operators)
- MDCCCLXVII
-
1000+ posts
"if () then () else ()" control block.
yes you do, because the function will need to containNo you don'tto make this work you need custom reporters as welldefine factorial (n)
set [factorial v] to (if <(n) = (0)> then (1) else ((n) * ((n) - (1))) mod ((n) - (1)) :: operators)
((n) * (factorial ((n) - (1)) :: custom))
- Scratchperson1000000
-
500+ posts
"if () then () else ()" control block.
I never put that apart of the definition script I NEVER SAID THAT THE FACTORIAL THING WOULD BE A REPORTERyes you do, because the function will need to containNo you don'tto make this work you need custom reporters as welldefine factorial (n)
set [factorial v] to (if <(n) = (0)> then (1) else ((n) * ((n) - (1))) mod ((n) - (1)) :: operators)((n) * (factorial ((n) - (1)) :: custom))
Do you even see me trying to put a factorial reporter? NO. Because I didn't want to
- the2000
-
1000+ posts
"if () then () else ()" control block.
No, you wouldn't, because they're using the “call the block beforehand and make it update an output variable” workaround. Though yes, those would be nice.to make this work you need custom reporters as welldefine factorial (n)
set [factorial v] to (if <(n) = (0)> then (1) else ((n) * ((n) - (1))) mod ((n) - (1)) :: operators)
- samurai_master123
-
100+ posts
"if () then () else ()" control block.
Why is everyone here clueless? This is a 5 year old topic! Even helpful scratchers with 1000+ posts haven't seen that this is 5 years old! DON'T NECROPOST!!!
- 9gr
-
1000+ posts
"if () then () else ()" control block.
Its not blockspamming its the person trying to give a workaround/howd it look. please stop blockspamming
- 9gr
-
1000+ posts
"if () then () else ()" control block.
Suggestions can be necroposted on because they may be coming from a new dupe. Also, people may want to support/give workarounds. Why is everyone here clueless? This is a 5 year old topic! Even helpful scratchers with 1000+ posts haven't seen that this is 5 years old! DON'T NECROPOST!!!
- Scratchperson1000000
-
500+ posts
"if () then () else ()" control block.
you cant necropost in the suggestions forum lol Why is everyone here clueless? This is a 5 year old topic! Even helpful scratchers with 1000+ posts haven't seen that this is 5 years old! DON'T NECROPOST!!!
- gosoccerboy5
-
1000+ posts
"if () then () else ()" control block.
Why was the old ternary operator topic dustbinned? Was it a dupe of this one? They could have at least merged it
- DualPikachu
-
100+ posts
"if () then () else ()" control block.
We already have the
if <> thenblock. And what stuff were supposed to be in the inputs? No support.
else
end
- the2000
-
1000+ posts
"if () then () else ()" control block.
Why does the age of the topic matter? Is the suggestion immediately invalid because it was made five years ago? Why is everyone here clueless? This is a 5 year old topic! Even helpful scratchers with 1000+ posts haven't seen that this is 5 years old! DON'T NECROPOST!!!
- MDCCCLXVII
-
1000+ posts
"if () then () else ()" control block.
it's a mystery Why was the old ternary operator topic dustbinned? Was it a dupe of this one? They could have at least merged it
- gosoccerboy5
-
1000+ posts
"if () then () else ()" control block.
Necroposting is defined as posting a long time after the last post, not the first. And, you can't really necropost in the suggestions forum Why is everyone here clueless? This is a 5 year old topic! Even helpful scratchers with 1000+ posts haven't seen that this is 5 years old! DON'T NECROPOST!!!
- Discussion Forums
- » Suggestions
-
» "if () then () else ()" control block.