Last active
December 8, 2017 10:25
-
-
Save vovs03/6d7041bbc93b7e750eb73c5f811dbfc5 to your computer and use it in GitHub Desktop.
Inspecting the logest words(string) [Выбор большего из аргументов]
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
#longest.rb | |
#puts "Now we can inspecting wich of words is longest" | |
puts "Input the first word." | |
a1 = gets.to_s | |
puts "Input the second word." | |
a2 = gets.to_s | |
puts "Result:" | |
#puts a1, a1.length-1 | |
#puts a2, a2.length-1 | |
def longest(a1,a2) | |
if a1.length-1 > a2.length-1 | |
puts a1, a1.length-1 | |
else | |
puts a2, a2.length-1 | |
end | |
end | |
puts longest(a1,a2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
долго бился над тем, что оказывается я не вызывал метод ) не хватало строки 25