This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-21 06:01:56

clubby789
New Scratcher
Registered: 2012-11-15
Posts: 17

While loops

I think there should be while loops! I always have to do things such as this:

[scratchblocks]
when gf clicked
wait until <(robots) = [10]>
repeat until < not(robots) < = [10]>>


Tell me if scratchblocks doesn't work!  smile

Offline

 

#2 2013-01-21 09:47:35

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: While loops

Well, you just told us a workaround, which takes only a little extra time...


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#3 2013-01-21 11:51:06

lalala3
Scratcher
Registered: 2008-10-03
Posts: 100+

Re: While loops

clubby789 wrote:

I think there should be while loops! I always have to do things such as this:

[scratchblocks]
when gf clicked
wait until <(robots) = [10]>
repeat until < not(robots) < = [10]>>


Tell me if scratchblocks doesn't work!  smile

You forgot to close it.

Edit: As in the [scratchblocks] tag.

Last edited by lalala3 (2013-01-21 11:53:01)


http://img515.imageshack.us/img515/9374/signature2nt.png

Offline

 

#4 2013-01-25 12:39:12

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: While loops

Allow me...

clubby789 wrote:

I think there should be while loops! I always have to do things such as this:

when gf clicked
wait until <(robots) = [10]>
repeat until < not(robots) < = [10]>>
Tell me if scratchblocks doesn't work!  smile


Why are the secret organizations getting all the attention?  mad

Offline

 

#5 2013-01-25 12:45:15

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: While loops

For something with a relatively simple workaround, I don't think this needs to be implemented.
If you really want a while loop, I wrote one in Insanity, when trying to figure out C blocks.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#6 2013-01-25 12:47:24

30-1
Scratcher
Registered: 2012-08-08
Posts: 100+

Re: While loops

Support!  big_smile


http://i.imgur.com/ocOya7x.gif
I. Text I Based I Games I

Offline

 

#7 2013-01-25 13:37:34

OverPowered
Scratcher
Registered: 2012-07-27
Posts: 100+

Re: While loops

"While" loops are far more common than "until" loops in other languages, it might be better for Scratch to use them instead of/in addition to "until" loops.  smile


Newest project: Tunnel TEST ~http://blocks.scratchr.org/API.php?user=OverPowered&amp;action=onlineStatus~ On my mind: Unicameralism

Offline

 

#8 2013-01-25 14:03:26

lalala3
Scratcher
Registered: 2008-10-03
Posts: 100+

Re: While loops

OverPowered wrote:

"While" loops are far more common than "until" loops in other languages, it might be better for Scratch to use them instead of/in addition to "until" loops.  smile

Not just more common, they're pretty much standard.


http://img515.imageshack.us/img515/9374/signature2nt.png

Offline

 

#9 2013-01-25 22:23:17

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: While loops

As standard as they may be, they may be harder to understand by the target audience of Scratch: Kids who are just starting to learn programming concepts, and use the program due to it being as close to the English (or their native) language as possible.

The functionality of a standard "while" loop even confuses me at times. Your typical Scratch user may interpret as the currently existing "forever if" loop:

when gf clicked
forever if <[1] < [2]>
say [do stuff]
end
But, that would be the equivalent of something like this in an actual programming language:

Code:

while true do
    if 1 < 2 then
        //do stuff
    end
end

The name of the "while" loop is quite misleading, considering Scratch is meant for absolute beginners. I don't support this idea.


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

Board footer