3 ms·
This is wrong: primes = [2, 3, 5, 7] puts primes[0..3] # => [2, 3, 5] It actually outputs [2, 3, 5, 7]. I believe the author meant to write: puts prime
by rauljara 15y ago
This is wrong:
primes = [2, 3, 5, 7]
puts primes[0..3] # => [2, 3, 5]
It actually outputs [2, 3, 5, 7]. I believe the author meant to write:
puts primes[0...3] # => [2, 3, 5]
Had trouble finding an email on his blog page. Hopefully the author is reading here.
- petercooper 15y ago[0, 3] could also have that behavior (3 elements from 0)
- bradly 15y agoIt's on Github, so you can send a pull request here: https://github.com/0xfe/rubyrefresher https://github.com/0xfe/rubyrefresher