4 ms·
In Mathematica the FullForm of a && b is And[a, b]. You can use this to format long lists of conditions as And[ a, b ] You can also re
by carlob 13y ago
In Mathematica the FullForm of a && b is And[a, b]. You can use this to format long lists of conditions as
And[
a,
b
]
You can also rely on the fact that logical expressions are always short-circuited, so False && Print["won't be printed"], doesn't print anything.
Finally, you can put a bunch of conditions in a list and do And @@ list.
- klez 13y ago> You can also rely on the fact that logical expressions are always short-circuited, so False && Print["won't be printed"], doesn't print anything. This is true for any language I can think of. E.g. in perl open(my $fh, "<", "input.txt") or die "cannot open < input.txt: $!"; is idiomatic