fortran数组下标、行号、continue

Fortran复健(1)

1、关于数组下标
若不加以额外声明,index从1开始,可以通过声明使其从0开始
real ::bin(0:13)
data ::bin/0,600,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000,12000,100000/
此时,bin(0)=0

2、continue的用法及循环的署名

The CONTINUE statement is often used as a place to hang a statement label, usually it is the end of a DO loop.
The CONTINUE statement is used primarily as a convenient point for placing a statement label, particularly as the terminal statement in a DO loop. Execution of a CONTINUE statement has no effect.
If the CONTINUE statement is used as the terminal statement of a DO loop, the next statement executed depends on the DO loop exit condition.

如:
do 10021 i=2016,2020
do 10021 j=1,12
……………
10021 continue
do后面的数字指定循环到某一行结束,fortran77中常用continue来结束循环,因为continue这个命令没有实际意义,正好可以用来封装。到fortran90才有end do,但fortran77也可以使用end do而非行号。
也即10021行的continue代替起两个end do的作用,表示循环体到此结束。

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值