Skip to content

Instantly share code, notes, and snippets.

Hon Lam lamh85

Block or report user

Report or block lamh85

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View repetitive_ors.rb
test_subject = "hello"
# Instead of doing repeptive ORs:
if test_subject == "hello" || test_subject == "world" || test_subject == "foo" || test_subject == "bar"
# do something
# Be more concise by using .include?
if ["hello", "world", "foo", "bar"].include?(test_subject)
You can’t perform that action at this time.