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 arithmetic operation #28

Merged
merged 1 commit into from
Dec 14, 2023
Merged

Conversation

haxibami
Copy link
Contributor

This ensures the expected behavior for all CANDIDATE_LEADING_FIELDS values.

@cohml
Copy link

cohml commented Dec 13, 2023

@haxibami I don't have any skin in the game of this PR, but I am curious enough to ask:

Can you provide one or two "before and after" examples demonstrating why the original code resulted in unexpected behavior and how your fix results in the expected behavior? Because to my reading, ! x == y and x != y are synonymous.

@haxibami
Copy link
Contributor Author

haxibami commented Dec 13, 2023

@cohml But they do not seem to be synonymous.

Sample script:

#!/usr/bin/env zsh

VALUE=2

if (( ! $VALUE == 3 )); then
    echo "1st challenge: VALUE is not 3"
else
    echo "1st challenge: VALUE is 3"
fi

if (( $VALUE != 3 )); then
    echo "2nd challenge: VALUE is not 3"
else
    echo "2nd challenge: VALUE is 3"
fi

Output:

1st challenge: VALUE is 3
2nd challenge: VALUE is not 3

@joshskidmore
Copy link
Owner

I completely missed the arithmetic brackets (vs standard grouping [[ ]]).

@joshskidmore joshskidmore merged commit 7410123 into joshskidmore:master Dec 14, 2023
@cohml
Copy link

cohml commented Dec 14, 2023

Oh yeah! My brain interpreted those as brackets as well. Cheers, all! And that @haxibami for the example as requested.

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