I'm trying to assign a number to each letter of the alphabet and print strings using the numbers 0 through 25.
Creating array: alphabet = ('A'..'Z').to_a
Printing array: puts alphabet[6,8].join gives me an output of GHIJKLMN, which is not what I was expecting. Expectation is for it to print: GI
Additionally, if I try: puts alphabet[6,8,15].join I get the following error: wrong number of arguments (given 3, expected 1..2) (ArgumentError)
I am using Ruby 2.3.1. What am I doing wrong?
[6,8,15]syntax? - AShellyArray#[]. That way, the Ruby developers can improve the documentation so that future developers do not stumble on the same roadblocks that you did. - Jörg W Mittag