I'm running Ruby's Range
test case but got an error in the line:
assert_equal([*"a".."z", "aa"], ("a"..).take(27))
The error message is:
test/ruby/test_range.rb:38: syntax error, unexpected ')'
...qual([*"a".."z", "aa"], ("a"..).take(27))
... ^
I also tried ('a'..)
in irb
and got a SyntaxError:
irb> ('a'..)
Traceback (most recent call last):
1: from /home/sergioro/.rvm/rubies/ruby-2.5.3/bin/irb:11:in `<main>'
SyntaxError ((irb):9: syntax error, unexpected ')')
('a'..)
My question is what is ('a'..)
? This syntax is used several times in the test case but it is not described in Range's documentation.
Aucun commentaire:
Enregistrer un commentaire