Trying to solve this question where you provide arguments and need to provide a matching output.
Take two integers (i and n) as command line arguments. Write i to standard output, followed by the following n integers (separated by commas).
Do not include spaces or any hidden characters in the output.
Example: Arguments: 3 5 Output: 3,4,5,6,7,8
base_number = ARGV.shift.to_i
iterate_number = ARGV.shift.to_i
if iterate_number < 0
base_number = base_number.to_s
iterate_number = iterate_number.to_s
base_number = base_number + 1
You're on the right track with
times, but you're missing out on one of the key features in Ruby: Leveraging an Enumerator and treating it like an array.
i = ARGV.to_i n = ARGV.to_i puts (i..i+n).to_a.join(', ')
This sets up a simple range, converts it to an array of values, then joins those values together.
If you want to test if a value is "numerical", try this:
value.to_i.to_s == value
If it's the same when converted to an integer and back it's guaranteed to be an integer value.