Where

Where, masks the evaluation of expression and assignments of values in array assignment statements, a stmt node.

声明

语法

Where(expr test, stmt* body, stmt* orelse)

参数

test contains condition or expression to be tested. body contains statement body. orelse contains the else condition if where is not true or served.

返回值

无。

描述

Where statement masks the evaluation of expression and assignments of values in array assignment statements. It does this according to the value of logical array expression.

If the where statement is not the first statement of where construct, it can be used as the terminal statement of a do or do while construct.

类型

Not applicable.

示例

program main
  real :: x(10)
  x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  where (x/=5)
     x = 32.0
  elsewhere
     x = 0.0
  end where
  print *, x
end program

ASR:


也可以看看