Last active
August 2, 2016 10:48
-
-
Save fee1good/6468c4f6e4c2cbbfeca866d0321d72e0 to your computer and use it in GitHub Desktop.
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
good_film = 'Matrix' | |
bad_film = 'Titanic' | |
definition = ARGV[0] | |
if definition == good_film | |
puts good_film.to_s + ' is a good movie' | |
elsif definition == bad_film | |
puts bad_film.to_s + ' is a bad movie' | |
else | |
puts 'Haven\'t seen ' + ARGV[0].to_s | |
end |
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
puts 'Ввведите название фильма:' | |
film_name = gets.chomp | |
name = ['Matrix','Matrix2','Matrix3'] | |
if name.include?(film_name.to_s) | |
puts film_name + ' is a good movie' | |
else | |
puts 'Haven\'t seen ' + film_name | |
end |
- переменные принято называт вот_так (маленькими буквами, слова разделяет подчерк)
- обрати внимание, что ты за программу несколько раз вызываешь ARGV[0],может положить его сразу в переменную?
- зачем столько to_s?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
К первой программе:
Ко второй: