Hello all,
first time posting, or emailing as it may be.
Im a newbie to Ruby and I am struggling with something that seems very
very simple to me but no matter what I try it I cant get my desired out
put. (therefore I guess it isnt easy.)
I want to iterate through my_array to see if the last element is == - if
it is replace that element with X
Then I want to repeat this operation.
I want to iterate through my_array to see if the last element is == to -
NO
move to the next to last element, is this element == to - YES replace
with X"
I know how to make them ALL change at once but that isnt my goal, it
needs to be one at time. Example would be receiving user input so I
would want to change the elements one at a time. Kind of like a match
data.
starting array
my_array = [3, -, -, -, -]
Hope this makes sense and thanks in advance for any help!
Troy