What's an example of good style for an "if/then" statement?
I'm not sure what's common for conditional statements, with and without alternative consequent clauses, in speech—even my own—but as a computer programmer, I'm niggled whenever I have to write English instructions that follow the form of a programmatic if (condition) doThis(); else doThat();
. I was just wondering what structure seemed clearest and least ambiguous (not necessarily restricted to the following), keeping in mind that the place-holders (condition
,alternative
,consequent
) might include punctuation such as one or more commas, or even a number of sub-clauses:
- If
<condition>
,<consequent>
. - If
<condition>
, then<consequent>
.
With alternative:
-
<If...>
, otherwise<alternative>
. -
<If...>
; otherwise,<alternative>
. -
<If...>
. Otherwise,<alternative>
. - If
...
is...
,<consequent>
. If...
isn't...
,<alternative>
. -
<If...>
, or else<alternative>
.- I've determined "or else" to be poor style. "Else" on its own would be better but still sounds inferior to otherwise or negating the condition.
Solution 1:
The basic format is If condition consequence. It's largely a matter of style whether you insert a comma and/or the word "then" between condition and consequence.
If the statement continues with an alternative, it should be preceded by a comma or period (or sometimes a dash). The most common form is otherwise consequence2 (optionally separated by a comma), but the word "otherwise" may be replaced by In all other cases, If not, Failing that, etc.
Variations on the second alternative involving the word "else" are normally either archaic, or you're writing program code.
Solution 2:
Your first two examples are both sound, though the first sounds more natural (read: casual):
If you heat water to 100 degrees Celsius, it boils.
If you heat water to 100 degrees Celsius, then it boils.
The three otherwise statements are quite similar, though the first is not optimal, since it is harder to parse and understand:
If it rains, we won't be able to attend, otherwise I see nothing against it.
If it rains, we won't be able to attend; otherwise, I see nothing against it.
If it rains, we won't be able to attend. Otherwise, I see nothing against it.
But the third does not fit the pattern:
If it rains, we won't be able to attend, or else I see nothing against it.
This means [If ... then this or that] rather than [If ... then this, otherwise that].