Dictionary: repeat

Richmond richmondmathewson at gmail.com
Sat Jul 23 11:58:14 EDT 2016


Erm . . .

So what is the difference between:

on mouseUp
   repeat with x = 1 to 20
    --do something
   end repeat
end mouseUp

&

on mouseUp
   put 1 into x
     repeat until x > 20
      --do something
      add 1 to x
    end repeat
on mouseUp

R.

On 23.07.2016 18:02, [-hh] wrote:
> Richmond wrote
>> "not recommended". If someone can explain in
>> a way that makes reasonable sense ...
> Predict the result of the following loop and
> remove or not the "shiftkey-exit":
>
> on mouseUp
>    repeat with x = 1 to 20
>      -- add -1 to x  -- not recommended
>      add -4/3 to x -- not recommended
>      put x into fld 1
>      if the shiftkey is down then exit repeat
>    end repeat
> end mouseUp
>
> "step" is especially useful in that you can do
> rather `complicated' subdivisions in a very simple way:
>
> on mouseUp
>    repeat with x = 1/13 to 1-1/13 step 1/13
>      put cr & x after s
>    end repeat
>    put char 2 to -1 of s into fld 1
> end mouseUp
>
> To the *precedence* of step in the repeat syntax see also:
> http://forums.livecode.com/viewtopic.php?f=8&t=27523
>
>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Dictionary-repeat-tp4706920p4706929.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list