if (condition) { /* do something */ } else { /* do something */ } if (condition) /* do something */ else /* do something */
I was told tha
Those are two lines long, so not really a single line.
There's nothing wrong with single line ifs when it makes the code easier to read.
if
For example, something like this:
if (last_item) print ", and " else print ", "
is much better than
if (last_iem) { print ", and " } else { print ", " }