Imagine that you have two arrays `A`

and `B`

of the same shape, and you would like to set `A`

to `0`

wherever `B`

is positive. This can be done by

```
where (B > 0)
A = 0
end where
```

This is great, but in MATLAB, it can be done in a more concise way, which is

```
A(B > 0) = 0
```

Here, A is indexed by an array of logicals (masks). Operations are affecting only the positions where the mask is `.true.`

. This seems to me a very convenient feature. It might be something worth considering in Fortran as well.

See here for more information about logical indexing in MATLAB: Matrix Indexing in MATLAB - MATLAB & Simulink

Python has a similar feature:

https://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/AdvancedIndexing.html