+ 4
If a==(1..12).to_i. Where a is user input in integers .Is it a correct statement to use,or i use another method
Using Ranges to create user input image in Ruby https://code.sololearn.com/cJNBLu7SOIP1/?ref=app
3 Answers
+ 4
Choe thanx lemme try it out
+ 1
a = gets.chomp.split().map(&:to_i)
if a == [*1..12]
#do something
end
+ 1
no, you have to use Double or Decimal instead of Int because you are using decimal number not whole number.