Discuss Scratch

clay231
Scratcher
5 posts

New Block: () Is Even/Odd?

Tronche2Cake wrote:

if <(round ((n) / (2))) = ((n) / (2))> then
even
else
odd
end


that's exactly what i did
ARandomNumberIs7482
Scratcher
1000+ posts

New Block: () Is Even/Odd?

clay231 wrote:

Tronche2Cake wrote:

if <(round ((n) / (2))) = ((n) / (2))> then
even
else
odd
end


that's exactly what i did
that's what i did too
snowbank4
Scratcher
59 posts

New Block: () Is Even/Odd?

if < ((num) / (2)) contains [.(period) ] ?> then
set [even_or_odd v] to [odd]
else
set [even_or_odd v] to [even]
end

Last edited by snowbank4 (July 23, 2023 19:55:29)

medians
Scratcher
1000+ posts

New Block: () Is Even/Odd?

snowbank4 wrote:

if < ((num) / (2)) contains [.(period) ] ?> then
set [even_or_odd v] to [odd]
else
set [even_or_odd v] to [even]
end
By the way, the contains operators block didn't exist in Scratch 2.0, so you're going to have to color it with scratchblocks syntax
Also I'm thinking you could also extend it to decimals like this:
https://scratch.mit.edu/discuss/post/7302132/

Sheep_maker wrote:

I've also noticed that the note input (such as the one in the Music extension) turns red when the given number is invalid, and it tries to correct the value when you click away, but other inputs don't do that
TIL!
Oh my god I never knew this I thought they would have kept this ability in 3.0, and I had to test this.
And I'm not sure if it's my extensions, but I can only see the correcting value thing.

Powered by DjangoBB