Discuss Scratch

NamePending_
Scratcher
100+ posts

Fractional repeat blocks

I'm not sure if this belongs in the HwS forum or not, but what happens if a repeat block has a decimal in it? If i have this code:
repeat (variable set to 3 point something)

end
then what would happen in the code? Would it round for how many times it would repeat?

Welcome to my signature!
Was this post helpful? If so, please consider checking out my profile!
say pasta in it please
100 POSTS YESSIRRRRRRRR
Plants4Life1200
Scratcher
100+ posts

Fractional repeat blocks

I just tested it, and I'm not able to put a decimal point in there in the first place.

Last edited by Plants4Life1200 (March 25, 2024 16:02:45)


All text below this gray line is my signature, it is not part of the post.

I do informational projects about plants, I play guitar and piano. I also play chess.

https://scratch.mit.edu/projects/1004451506/ This project is where I will write a story using the results of the polls!
NamePending_
Scratcher
100+ posts

Fractional repeat blocks

Plants4Life1200 wrote:

I just tested it, and I'm not able to put a decimal point in there in the first place.
Yes, but you could use this:
repeat (variable) // set to a decimal

end
So what would happen if you did that?

Welcome to my signature!
Was this post helpful? If so, please consider checking out my profile!
say pasta in it please
100 POSTS YESSIRRRRRRRR
AAchiefs15
Scratcher
100+ posts

Fractional repeat blocks

testing it, it seems to just round it to the nearest number

xavier worthy
malicondii
Scratcher
100+ posts

Fractional repeat blocks

It rounds the decimal to the nearest whole number. Negatives simply just do not work, and function the same as repeating 0.
Plants4Life1200
Scratcher
100+ posts

Fractional repeat blocks

NamePending_ wrote:

Plants4Life1200 wrote:

I just tested it, and I'm not able to put a decimal point in there in the first place.
Yes, but you could use this:
repeat (variable) // set to a decimal

end
So what would happen if you did that?
Tested, the variable just rounds to the nearest number.

Last edited by Plants4Life1200 (March 25, 2024 16:14:47)


All text below this gray line is my signature, it is not part of the post.

I do informational projects about plants, I play guitar and piano. I also play chess.

https://scratch.mit.edu/projects/1004451506/ This project is where I will write a story using the results of the polls!
NamePending_
Scratcher
100+ posts

Fractional repeat blocks

OK, thanks for the help

Welcome to my signature!
Was this post helpful? If so, please consider checking out my profile!
say pasta in it please
100 POSTS YESSIRRRRRRRR

Powered by DjangoBB