My code:
def wave(str) ary = [] increase_num = 0 str = str.chars until increase_num > str.size ary << str[increase_num].upcase && increase_num += 1 end end
What it's supposed to do:
wave("hello") => ["Hello", "hEllo", "heLlo", "helLo", "hellO"]
I would really appreciate some help, as you probably know by looking at it I'm relatively new.
str = "hello"
str.size.times.map { |i| str[0,i] << str[i].upcase << str[i+1..] } #=> ["Hello", "hEllo", "heLlo", "helLo", "hellO"]
2.1m questions
2.1m answers
60 comments
57.0k users