Created
June 5, 2017 08:35
-
-
Save beck03076/9699c5e851da182992cc1c39c0d653b9 to your computer and use it in GitHub Desktop.
inclusive_exclusive_from_ruby.rb
This file contains hidden or 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
# show me a tank thats larger than 100000000000 diameter | |
DIAMETERS = [0, 12.2, 45.7, 76.2, 100000000000].freeze | |
RADII_TOLERANCE = [12.7, 19.05, 25.4, 31.75].freeze | |
current_diameter = 76.2 | |
each_cons_index = 0 | |
final_radii_tolerance = nil | |
DIAMETERS.each_cons(2) do |diameter_window| | |
if current_diameter >= diameter_window[0] && current_diameter < diameter_window[1] | |
final_radii_tolerance = RADII_TOLERANCE[each_cons_index] | |
break | |
end | |
each_cons_index += 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment