<BLOCK Example Program>
Program demonstrate_block
Implicit None
Integer i,tmp
Real :: a(10) = [ (i,i=1,10) ]
Real :: b(10) = 100
tmp = 42
Do i=1, Size(a)
Block
Real tmp
tmp = a(i)**3
If (tmp>b(i)) b(i) = tmp
End Do
! The outer "tmp" is unaffected by the inner one.
Print 1, tmp, b
1 Format(1X,I0,10F7.1)
End Program
■ Execution Results
42 100.0 100.0 100.0 100.0 125.0 216.0 343.0 512.0 729.0 1000.0