+ 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

23rd Aug 2019, 10:15 AM
E∆SI🇳🇬🤖
E∆SI🇳🇬🤖 - avatar
3 Antworten
+ 4
Choe thanx lemme try it out
24th Aug 2019, 9:07 AM
E∆SI🇳🇬🤖
E∆SI🇳🇬🤖 - avatar
+ 1
a = gets.chomp.split().map(&:to_i) if a == [*1..12] #do something end
23rd Aug 2019, 9:59 PM
Choe
Choe - avatar
+ 1
no, you have to use Double or Decimal instead of Int because you are using decimal number not whole number.
7th Sep 2019, 9:33 AM
khanna