Skip to content

Commit 966fe2a

Browse files
committed
Improve some wording
1 parent bb8cee1 commit 966fe2a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.adoc

+9-7
Original file line numberDiff line numberDiff line change
@@ -1422,10 +1422,12 @@ end
14221422

14231423
=== `and`/`or` [[no-and-or-or]] [[and-or-flow]]
14241424

1425-
`and` and `or` are control flow operators. They have very low precedence, and can be used as a short
1426-
form of specifying flow sequences like "evaluate expression 1, and only if it is not successful
1427-
(returned `nil`), evaluate expression 2". This is especially useful for raising errors or early
1428-
return without breaking the reading flow.
1425+
Do not use `and` and `or` in boolean context - `and` and `or` are control flow
1426+
operators and should be used as such. They have very low precedence, and can be
1427+
used as a short form of specifying flow sequences like "evaluate expression 1,
1428+
and only if it is not successful (returned `nil`), evaluate expression 2". This
1429+
is especially useful for raising errors or early return without breaking the
1430+
reading flow.
14291431

14301432
[source,ruby]
14311433
----
@@ -1454,8 +1456,8 @@ ok = got_needed_arguments && arguments_valid
14541456
x = extract_arguments || raise(ArgumentError, "Not enough arguments!")
14551457
----
14561458

1457-
But avoid several control flow operators in one expression, that becomes
1458-
confusing:
1459+
But avoid several control flow operators in one expression, as that quickly
1460+
becomes confusing:
14591461

14601462
[source,ruby]
14611463
----
@@ -1478,7 +1480,7 @@ if x
14781480
end
14791481
---
14801482
1481-
NOTE: Whether organizing control flow with `and` and `or` is a good idea was a controversial topic in the community for a long time. But if you do, prefer these operators over `&&`/`||`.
1483+
NOTE: Whether organizing control flow with `and` and `or` is a good idea has been a controversial topic in the community for a long time. But if you do, prefer these operators over `&&`/`||`.
14821484
14831485
=== Multi-line Ternary Operator [[no-multiline-ternary]]
14841486

0 commit comments

Comments
 (0)