Skip to content

Instantly share code, notes, and snippets.

@ilyabrin
Forked from emad-elsaid/multi-equal-check.rb
Created April 5, 2014 12:24
Show Gist options
  • Save ilyabrin/9991322 to your computer and use it in GitHub Desktop.
Save ilyabrin/9991322 to your computer and use it in GitHub Desktop.
class Array
def same?
uniq.length==1
end
end
x = 1
y = 2
z = 2
l = 2
# old way : x==y and y==z
puts [x,y,z].same? # false
# old way : y==z and z==l
puts [y,z,l].same? # true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment