Skip to content

Commit f5a1738

Browse files
authored
Update ch04-02-do.md
1 parent f53409a commit f5a1738

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/ch04-02-do.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,17 @@ print *, result_sin
143143
``` fortran
144144
program main
145145
implicit none
146-
!integer::i
146+
integer::i
147+
integer::a(4)
148+
a=[(i,i=1,4)]
149+
write(*,*)a
150+
end program main
151+
```
152+
请读者自己尝试运行
153+
``` fortran
154+
program main
155+
implicit none
147156
integer::a(4)
148-
!a=[(i,i=1,4)]
149157
a=[(j,integer::j=1,4)] !也可以内部定义循环变量,目前`gfortran`不支持,`ifx,ifort,flang`支持
150158
write(*,*)a
151159
end program main

0 commit comments

Comments
 (0)