if statement - Equivalence of IF and WHERE -


we know do loop more powerful forall statement in fortran. is, can substitute forall do, not vice versa.

what where statement , block?

can substitute if where? possible code conditionals , bifurcations where, avoiding if?

where statements reserved arrays assignments , nothing else, e.g.:

integer, dimension(100,100) :: a, b ... define ... where(a < 0)    b = 1 elsewhere    b = 0 endwhere 

if tried adding in something, write statement, inside where block, see following compiling error (compiler dependent):

error: unexpected write statement in block @ (1) 

edit

note nested where blocks legal:

where(a < 0)    where( abs(a) > 2)       b = 2    elsewhere       b = 1    endwhere elsewhere    b = 0 endwhere 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -