1. while do & end while

>
><<snip>>
>
>while 1 do 
>if condition1 then exit end if 
>if conditionN then return end if 
>end while
>
><<snip>>
>
>This is EU power -- ALL you want just in two main forms.
>
>Regards,
>Igor Kachan

I think I understand that, too?   

while 1 do   
   --/ when condition1 is True, it will exit the loop   
   --/ and finish anything else in the procedure.
if condition1 then exit end if     
   --/ when conditionN is True, it will exit the procedure!
if conditionN then return end if  
end while

new topic     » topic index » view message » categorize

2. Re: while do & end while

>><<snip>>
>
>while 1 do   
>   --/ when condition1 is True, it will exit the loop   
>   --/ and finish anything else in the procedure.
>if condition1 then exit end if     
>   --/ when conditionN is True, it will exit the procedure!
>if conditionN then return end if  
>end while
>

I have another question?  if you want condition1 to exit 
when False or 0, just add NOT after the condition???

atom condition1
while 1 do
  condition1 = rand(10)
  if condition1 NOT then exit end if    
end while

new topic     » goto parent     » topic index » view message » categorize

3. Re: while do & end while

Hi timelord,

----------
> Îò: timelord at zebra.net
> Êîìó: EUforum <EUforum at topica.com>
> Òåìà: while do & end while
> Äàòà: Saturday, January 19, 2002 20:44

> >while 1 do 
> >if condition1 then exit end if 
> >if conditionN then return end if 
> >end while

> I think I understand that, too?   
> 
> while 1 do   
>    --/ when condition1 is True, it will exit the loop   
>    --/ and finish anything else in the procedure.
> if condition1 then exit end if     
>    --/ when conditionN is True, it will exit the procedure!
> if conditionN then return end if  
> end while

This more detaled may be:

procedure Loop()
   while 1 do --- loop #1
   .......  --some operators
      if condition1 then exit end if   -- exit from loop #1 to loop #2
   .......  --some operators
      if conditionN then return end if -- return from Loop() procedure,
skip loop #2
   .......  --some operators
  end while
  
  while 2 do --- loop #2
   .......  some operators
      if conditionK then exit end if   -- exit from loop #2 and then finish
                                       -- of Loop() procedure
   .......  --some operators
  end while
end procedure

Loop()

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

4. Re: while do & end while

Hi again timelord,

<snip>

> I have another question?  if you want condition1 to exit 
> when False or 0, just add NOT after the condition???
> 
> atom condition1
> while 1 do
>   condition1 = rand(10)
>   if condition1 NOT then exit end if    
> end while

If you really have condition1=0, i.e. False,
then you *must* to say :

if not condition1 then exit end if

to get 1, Truth, and exit loop.

But rand(10) is Truth anyway, these numbers 
are from 1 to 10, so if you'll say:

if not condition1 then exit end if

then you get just zeros, False, 
and your loop is ***infinite***.

Do not play with infinite loops ! :-[

Read the manual, refman.doc or refman.htm !

Good Luck With Good Loops ! smile

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu