Discuss Scratch

MohammedHayyan
Scratcher
29 posts

Additional Block Suggestions

Considering the fact that Scratch is an introductory programming website, there are a few aspects of the programming language that are missing that can be essential for learners in the future

Like a “while” loop. Just like how in python, you could write:

while this_sprite.x < 100:
  this_sprite.x += 10

You could also do:

when flag clicked
while <(x position) < (100)> {
change x by (10)
}::control

Or a loop that iterates over a list, like

for fruit in fruits:
  print(fruit)
  time.sleep(1)

and

when flag clicked
for every (item [fruit]::list) in [fruits v] {
say (item [fruit]::list) for (1) seconds
}::list

And maybe some even more math, like the highly requested exponent block, or having the ability to add or remove additional arithmetic operators like in Snap!. So for example, instead of

print(1 + 2 + 3)

being

when flag clicked
say ((1) + ((2) + (3))) for (1) seconds

it could be

when flag clicked
say ((1) [+ v] (2) [+ v] (3) @delInput@addInput::operators) for (1) seconds

so things won't get messy/confusing
kelvinkelvin2015
Scratcher
56 posts

Additional Block Suggestions

For while and for loops, they already exists and serve as a hidden block. Wiki page here and here
MohammedHayyan
Scratcher
29 posts

Additional Block Suggestions

quote=kelvinkelvin2015]
For while and for loops, they already exists and serve as a hidden block. Wiki page here and here

Sure, I can agree with the while workaround, but for the “for loop,” it can get quite messy with somewhat tens, or hundreds of for loop vars in a big project.
swassbac
Scratcher
1 post

Additional Block Suggestions

Yeah, you can backpack a for loop from a "hacked project", but you cant loop through lists with it::motion cat
A @stopSign depraciticed@stopSign for loop looks like::looks
for each [i v] in (10){
say (i)
}@loopArrow::control



but a loop through list block would look like this @greenFlag::control hat
for each item [food v] in (foods::list){
say (i)
}@loopArrow::list
That would be very helpful!::pen cap

Also a join would be good where you could keep adding elements::sensing hat
say(join(apple) and (banna) and (grape)[+ v]::operators)
Hope this gets implemented!!!::procedures cap

Powered by DjangoBB