Control Structure Question 
Author Message
 Control Structure Question

I am using APL*Win version 2.0.  In the help section, it says that you can
exit a :FOR :IN loop by using :LEAVE statement, or go to the next iteration
with a :CONTINUE statement.  Could anyone tell me why the following doesn't
work (and gives me a syntax error)?

{execute}(condition)/':LEAVE'

I've tried

{execute}(condition)/'->:LEAVE'

and this doesn't work either.

I get the same error when trying :CONTINUE

Thanks,

Lance



Thu, 26 Jan 2006 06:37:56 GMT  
 Control Structure Question

Quote:

> I am using APL*Win version 2.0.  In the help section, it says that you can
> exit a :FOR :IN loop by using :LEAVE statement, or go to the next iteration
> with a :CONTINUE statement.  Could anyone tell me why the following doesn't
> work (and gives me a syntax error)?

> {execute}(condition)/':LEAVE'

> I've tried

> {execute}(condition)/'->:LEAVE'

> and this doesn't work either.

> I get the same error when trying :CONTINUE

Unlike labels, control structure keywords don't have values
and can't be used in expressions.  They are purely syntactic.

Try

        :If condition
                :Leave
        :EndIf



Thu, 26 Jan 2006 13:47:24 GMT  
 Control Structure Question

Quote:

>I am using APL*Win version 2.0.  In the help section, it says that you can
>exit a :FOR :IN loop by using :LEAVE statement, or go to the next iteration
>with a :CONTINUE statement.  Could anyone tell me why the following doesn't
>work (and gives me a syntax error)?

>{execute}(condition)/':LEAVE'

>I've tried

>{execute}(condition)/'->:LEAVE'

>and this doesn't work either.

>I get the same error when trying :CONTINUE

Control structures aren't executable, which is a fancy way of saying
that using {execute} on them just won't work.  The interpreter
recognizes control structures only in statements where the ':' is the
first character.  But you can separate statements on a line:

      :IF (condition) <> :LEAVE <> :ENDIF

['<>' for single character {diamond}]

The gravy is that this will execute far more efficiently than anything
with an {execute}.

Eric Landau, APL Solutions, Inc.
"Sacred cows make the tastiest hamburger." - Abbie Hoffman



Fri, 27 Jan 2006 07:55:34 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. control structure question

2. More control structures

3. Proposal for control structures in APL

4. Proposal for control structures in APL

5. Proposal for control structures in APL (SAMSON)

6. Control Structures in APL

7. Control Structures in APL

8. Control structures in APL

9. APL Control Structures

10. Control structures.

11. Control structures in APL

12. Control structures; discussion or proposal

 

 
Powered by phpBB® Forum Software