Okay, when I split a string at every space, it does what’s expected. But
when I call the array at x (array[x]) it only shows the first letter
rather than the part of the string I split. Let me just show you what
the problem is…
a = “one two three”
=> “one two three”
a.split(" ")
=>[“one”, “two”, “three”]
num = 0
=> 0
while num < a.length
puts a[num]
num = num + 1
end
o
n
e
t
w
o
t
h
r
e
e
=> nil
Can someone explain to me why this is happening? Why isn’t it showing
this instead?
“one
two
three
=> nil”