Logo

Programming-Idioms

History of Idiom 12 > diff from v87 to v88

Edit summary for version 88 by spectrum:
New Fortran implementation by user [spectrum]

Version 87

2019-09-27, 23:09:39

Version 88

2019-09-28, 13:38:23

Idiom #12 Check if list contains a value

Check if list contains a value x.
list is an iterable finite container.

Illustration

Idiom #12 Check if list contains a value

Check if list contains a value x.
list is an iterable finite container.

Illustration
Extra Keywords
array vector
Extra Keywords
array vector
Code
if (any(x == list)) ...
Comments bubble
"x == list" returns an array of booleans. any() is true if any element of the argument array is true.