Discuss Scratch
- Discussion Forums
- » Suggestions
- » Add the conditional operator, a condensed if/else
- Codingfairy07
-
500+ posts
Add the conditional operator, a condensed if/else
The link doesn't work.As Sheep_Maker has pointed out, this is a Support. This could be so useful for 1LCs.duplicate. Please continue the discussion there.
Last edited by Codingfairy07 (June 25, 2021 16:04:14)
(φ゜▽゜*♪) :: sensing // This is Laura, my kumquat guard who never sleeps. Sleeping is for amateur Kumquat guards.Announcement
;
- DJUmbreon2
-
100+ posts
Add the conditional operator, a condensed if/else
I support, even tho I have a block of that type on my profileA better way to do that would just be to add custom reporters (Sratch Team, please)< if <>, then [] else [] :: control>
If they dont come, SupportWHAT?? No Support, thats litterly justIf <>, then ((::stack control) :: grey ring), else ((::stack control) :: grey ring)::controlif <> then
else
endtoo easy of a workaround without much usefulness, No Support<if <>, then <> else<> :: control>
(Also, its kinda redundant with the reporter thingy)<<<if> and <Input then>> or <<not <if>> and <Input else>>>
- orangetheory
-
500+ posts
Add the conditional operator, a condensed if/else
I think this would be very useful - it is a quicker way but does the same things as the if else block…. But I'm saying, you have my support! ![](//cdn.scratch.mit.edu/scratchr2/static/__9a0e4e4ed083c6ff07e94c0ff50759f2__/djangobb_forum/img/smilies/big_smile.png)
![](http://cdn.scratch.mit.edu/scratchr2/static/__9a0e4e4ed083c6ff07e94c0ff50759f2__/djangobb_forum/img/smilies/big_smile.png)
-Frisbee- -Cricket--Basketball--Forums--Mapping--Coding--Trigonometry master--Mathematics King--Future Prime Minister--Intro-Maker-
I know HTML/CSS, and JavaScript, and with these coding skills I have made some decent projects! Test them out below!
~Archery~Cops + Robbers~
Want an intro, outro, music, effects, or more? Check out the intro shop!
![](https://assets.scratch.mit.edu/get_image/.%2E/b3b61f14df6a6b9bb34a55b867637b1e.png)
The forum helpers, a place where we help people in the forums
![](https://cdn2.scratch.mit.edu/get_image/project/558102868_1000x800.png)
- cyleja1234
-
3 posts
Add the conditional operator, a condensed if/else
((<(foo) < [1]>*(1.5))+(2))basically if foo is less then 1 it will return 3.5 else it will return 2
the Boolean operator will turn to 1 if true 0 if false so lets say that the Boolean is false then:
0 * 1.5 = 0 so 0 + 2 =2
but if it is true then:
1 * 1.5 = 1.5 so 1.5 + 2 =3.5
hope this helps!
- cyleja1234
-
3 posts
Add the conditional operator, a condensed if/else
((<(foo) < [1]>*(1.5))+(2))basically if foo is less then 1 it will return 3.5 else it will return 2
the Boolean operator will turn to 1 if true 0 if false so lets say that the Boolean is false then:
0 * 1.5 = 0 so 0 + 2 =2
but if it is true then:
1 * 1.5 = 1.5 so 1.5 + 2 =3.5
hope this helps!
also this will help for stuff like sprint and stamina, if stamina is not 0 and you are holding the sprint key it will move 3.5 in the x direction else move 2 in the x direction.
- Discussion Forums
- » Suggestions
-
» Add the conditional operator, a condensed if/else