zgyin的个人博客分享 http://blog.sciencenet.cn/u/zgyin


class- for 循环

已有 3018 次阅读 2015-7-28 17:44 |个人分类:class|系统分类:科研笔记

LAS> help for
       [SIC]FOR Loop_Variable n1 n2 n3 TO n4 BY n5 n6 TO n7
       [SIC]FOR /WHILE Logical_Expression
   Open  a  FOR-NEXT  loop to be executed for values in the list (FOR Vari-
   able), or until a logical expression becomes false  (FOR  /WHILE).   The
   last  character of the prompt becomes a ':' instead of '>', and all sub-
   sequent commands typed in until NEXT are the body of  the  loop.  Up  to
   nine  loops may be nested in any way. The index of the loop will be sub-
   stituted to the loop variable Loop_Variable during loop  execution.  The
   substitution  occurs  also within character strings if the loop variable
   name is included between single quotes. Note that the index  values  may
   be real.
       [SIC]FOR Loop_Variable n1 n2 n3 TO n4 BY n5 n6 TO n7
   The loop specified in this example will execute for the following values
   of the index :
           n3, n3 + n5, n3 + 2 n5, n3 + 3 n5, ... , n4
           n6, n6 + 1, n6 + 2, ... , n7
   (assuming that n4-n3 is a multiple of n5, n7-n6 an integer).  Loop vari-
   ables  are  undefined  outside  the loop, and must not be previously de-
   fined. Invalid ranges are ignored at execution time: e.g. in the  previ-
   ous  example,  the  loop  would  not  be  executed for n3 TO n4 BY n5 if
   n5*(n4-n3) < 0, but no error is signaled. Increments of 0 produce an er-
   Conditional  loops  execute  until the logical expression becomes false.
   For example FOR /WHILE .TRUE. will execute forever.


LAS> for i 1 to 30 by 2       ! 循环变量是i 初始值是1,结束值是30,循环变量的变化步长是2,也就是循环变量每次加2
LAS: get 100+(i-1)*8         ! 获取    100+(i-1)*8对应的谱线
LAS: write
LAS: next i


收藏 IP: 159.226.171.*| 热度|


该博文允许注册用户评论 请点击登录 评论 (0 个评论)


Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2022-9-30 05:02

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社