Old habits die hard...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Old habits die hard...

It may be a while before I automatically think "loop i = 1 to 10"
instead of "do i=1 to 10", but I believe it's definitely an
improvement in the language.  Mike obviously tried to accomodate us
dinosaurs, but it doesn't seem to be helping (me) much.  The
following erroneous code snippet produces the subsequent console log:

  do i = 1 to 3
  say 'i=' i
  end i

[N:\nrx\jnrw\3_flowcontrol]nrc -run looptst
NetRexx portable processor, version 1.113
Copyright (c) IBM Corporation, 1997.  All rights reserved.
Program looptst.nrx
 1 +++   do i = 1 to 3
   +++      ^
   +++ Warning: Wrong syntax for DO; retrying as a LOOP instruction
 2 +++   say 'i=' i
   +++            ^
   +++ Error: Unknown variable
 3 +++   end i
   +++   ^^^
   +++ Error: Unexpected END (no unended DO, LOOP, or SELECT)
Compilation of 'looptst.nrx' failed [2 errors, one warning]


Mike, if it's not possible for this sort of ubiquitous loop contruct
to be recognize with the 'do' keyword, perhaps it would be better to
have the warning say "Wrong syntax for DO; did you mean LOOP?"   :-)

Regardless, I presume that if 'retrying as a LOOP instruction' is
successful, it would avert the other two errors, right?

-Chip-  Member of Rexx Language Association & TeamOS/2 & Thoroughly Warped!
Aresti Systems  POB 13306  Research Triangle Pk NC 27709-3306  919.303.3306
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>