Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix contradictory example in Conditionals #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkolodny
Copy link

@mkolodny mkolodny commented Dec 4, 2013

The example in the Conditionals section shows that if...else should be preferred over unless...else for negative conditions. Yet the description above the example says the opposite.
This removes the contradiction so that if...else is preferred in both the description and the example.

@mjrusso
Copy link
Member

mjrusso commented Dec 4, 2013

I think what the first sentence is referring to are statements like these, where the unless is used in postfix form:

# Yes
go() unless stop

# No
go() if not stop

So the sentence could read instead:

Favor unless over if not for negative conditions.

This does contradict the next sentence about unless...else, so it may be best to swap the order of the two sentences, include the example above, and reword the earlier sentence to something like this:

In postfix form, favor unless over if not for negative conditions.

This should preserve the original meaning and be less ambiguous.

@@ -299,9 +299,9 @@ Prefer single quoted strings (`''`) instead of double quoted (`""`) strings, unl
<a name="conditionals"/>
## Conditionals

Favor `unless` over `if` for negative conditions.
Favor `if` over `unless` for negative conditions.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants