HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

FizzBuzz in Scratch

Submitted by: @import:stackexchange-codereview··
0
Viewed 0 times
scratchfizzbuzzstackoverflow

Problem

Before you close vote:

Yes, Scratch questions are okay.

Link to project on Scratch

For the hundredth fizzbuzz question, I'd thought I'd spruce it up a bit and post something new.

So, first make three variables named i, iterations and string:

And a list named ListOfFBs (FBs = FizzBuzzes)

Here is my main code:

Which produces an output like:

Solution

Instead of setting iterations programmatically to 30, I recommend making it a slider so that it can serve as your input.

To clear ListOfFBs, you can just do delete all of LisfOfFBs instead of

set i to 1
repeat (length of ListOfFBs):
    delete i of ListOfFBs


I think we can do away with i and string. i is just length of ListOfFBs. string is just item last of ListOfFBs.

Suggested solution

Code Snippets

set i to 1
repeat (length of ListOfFBs):
    delete i of ListOfFBs

Context

StackExchange Code Review Q#112708, answer score: 7

Revisions (0)

No revisions yet.