Created
May 5, 2019 01:07
-
-
Save izzuddin91/addf993c05fa44abddf0727bd205e117 to your computer and use it in GitHub Desktop.
Crops function
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
puts "Please select crop number and separated by comma if more than one : \n 1) apple \n 2) pear" | |
a = gets.chomp | |
#receive string with comma separated | |
b = a.split(",") | |
# puts "#{b}" | |
b.each do |x| | |
#received string. convert to integer first | |
c = x.to_i | |
#compare the number | |
if c == 1 | |
puts "is in luke garden" | |
elsif c == 2 | |
puts "is in paul garden" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@githubfatin123