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

Use safe navigation rather than try #726

Merged
merged 1 commit into from
Oct 24, 2023
Merged

Use safe navigation rather than try #726

merged 1 commit into from
Oct 24, 2023

Conversation

jcoyne
Copy link
Contributor

@jcoyne jcoyne commented Oct 24, 2023

Try checks to see if the value responds to the method name. We don't need to do that. We only need to do a nil check, so the safe-navigation operator is more efficient and clearly expresses the intent.

Try checks to see if the value responds to the method name.  We don't need to do that. We only need to do a nil check, so the safe-navigation operator is more efficient and clearly expresses the intent.
@thatbudakguy thatbudakguy merged commit cd50a29 into main Oct 24, 2023
@thatbudakguy thatbudakguy deleted the avoid-try branch October 24, 2023 17:16
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.

2 participants