Have a question (as usual, from a thread on ruby-forum.org,
http://www.ruby-forum.org/bb/viewtopic.php?t=75) :
Expression /start/../end/ is invalid because Regexp doesn't have <=>
method, but this code is printed in Pickaxe:
while gets
print if /start/../end/
end
with comment
QTE
As well as representing sequences, ranges may also be used as
conditional expressions. For example, the following code fragment prints
sets of lines from standard input, where the first line in each set
contains the word ``start'' and the last line the word ``end.''
UNQTE
As the author of the thread puts it,
QTE
What in the world is this program really supposed to do? Whatever I type
in at standard input it prints out. /start/../end/ just seems to be a
synonym for "true". I can't make sense of this example. Is it wrong?
UNQTE
To which I would like to add: what in the world is the syntactic
difference between
/start/../end/
and
if (/start/../end/)
that the former is rejected, and the latter is accepted by the
interpreter?
Alex