Skip to content

Instantly share code, notes, and snippets.

@izzuddin91
Created May 5, 2019 01:07
Show Gist options
  • Save izzuddin91/addf993c05fa44abddf0727bd205e117 to your computer and use it in GitHub Desktop.
Save izzuddin91/addf993c05fa44abddf0727bd205e117 to your computer and use it in GitHub Desktop.
Crops function
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
@izzuddin91
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment