E
Eva
Hi,
Please take a look at below:
def mytest
return [1..10]
end
x = mytest
x.each do |c| puts c end
this works not as I expected.
I want the output of:
1
2
3
4
5
6
7
8
9
10
But if I change return [1..10] to return 1..10 it will work.
So what's the difference between 1..10 and [1..10]?
THanks.
Please take a look at below:
def mytest
return [1..10]
end
x = mytest
x.each do |c| puts c end
this works not as I expected.
I want the output of:
1
2
3
4
5
6
7
8
9
10
But if I change return [1..10] to return 1..10 it will work.
So what's the difference between 1..10 and [1..10]?
THanks.