[J3] [EXTERNAL] [BULK] Re: A couple more ideas for features

Holcomb, Katherine A (kah3f) kah3f at virginia.edu
Thu Apr 6 15:24:55 UTC 2023


As already noted, do while (.not. cond) is not equivalent to a repeat until, since it will not execute if .not. cond starts as F whereas a repeat until cond will execute at least once regardless of the initial value of the conditional.  Sometimes that behavior is desirable.

The equivalent would be like C++
do
   Stuff
while (cond)
To my knowledge, Fortran doesn’t support this  (?)

Katherine Holcomb
UVA Research Computing  https://www.rc.virginia.edu
kah3f at virginia.edu<mailto:kah3f at virginia.edu>    434-982-5948
From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Clune, Thomas L. (GSFC-6101) via J3
Sent: Thursday, April 6, 2023 11:11 AM
To: David Muxworthy <d.muxworthy at bcs.org.uk>; General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Clune, Thomas L. (GSFC-6101) <thomas.l.clune at nasa.gov>; d.muxworthy at icloud.com
Subject: Re: [J3] [EXTERNAL] [BULK] Re: A couple more ideas for features

Hi David,

EXIT and CYCLE definitely make DO WHILE unnecessary; no argument there.   But I have many cases where I consider DO WHILE(cond) to make the loop more intelligible to humans.  My guess is that there are far fewer cases where DO … UNTIL provides such additional clarity.

Cheers,


  *   Tom

From: J3 <j3-bounces at mailman.j3-fortran.org<mailto:j3-bounces at mailman.j3-fortran.org>> on behalf of j3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
Reply-To: David Muxworthy <d.muxworthy at bcs.org.uk<mailto:d.muxworthy at bcs.org.uk>>, j3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
Date: Thursday, April 6, 2023 at 11:06 AM
To: j3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
Cc: "d.muxworthy at icloud.com<mailto:d.muxworthy at icloud.com>" <d.muxworthy at icloud.com<mailto:d.muxworthy at icloud.com>>
Subject: [EXTERNAL] [BULK] Re: [J3] A couple more ideas for features

CAUTION: This email originated from outside of NASA.  Please take care when clicking links or opening attachments.  Use the "Report Message" button to report suspicious messages to the NASA SOC.




The DO block was introduced in F90.  As I remember the discussions, it was thought that DO ... END DO with EXIT and CYCLE made WHILE and UNTIL unnecessary.  However WHILE got added because other languages had it.

David



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230406/82b4e5eb/attachment.htm>


More information about the J3 mailing list