Hello world. In Javascript, Im used to write long and complex conditions on several lines, with many parentheses, just like this:
if (
(a.blablabla == b.blablabla or a.blobloblo == b.blobloblo)
||
(c.blablabla == d.blablabla or c.blobloblo == d.blobloblo)
) { // whatever }
That helps me to visualize clearly the logic of my code.
But when I try to do something similar in Nim, the whitespace sensitiveness of the language make it impossible. Please what fix do you suggest for this issue ?
You can do multiline, although you have to put the conjunction ("and", "or") at the end of the line.
if a == "A" and
b == "B":
echo "Huzzah!"
also if you need multi line maybe its best to assign it?
let
alive = a.blablabla == b.blablabla or a.blobloblo == b.blobloblo
active = c.blablabla == d.blablabla or c.blobloblo == d.blobloblo
if alive and active:
doo stuff
Or even
if
a == "A" and
b == "B"
:
echo "aaaHuzzah!"