Created
January 10, 2012 03:00
-
-
Save coreymartella/1586608 to your computer and use it in GitHub Desktop.
version compare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print "version1:";STDOUT.flush | |
v1 = gets.strip.split(".").map(&:to_i) | |
print "\nversion2:";STDOUT.flush | |
v2 = gets.strip.split(".").map(&:to_i) | |
diff = v1 <=> v2 | |
puts "v1 < v2" if diff < 0 | |
puts "v1 = v2" if diff == 0 | |
puts "v1 > v2" if diff > 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment