Range as conditional expr

S

Steve

In the Second Edition of the Pickaxe, on page 68 it says:

In older versions of Ruby, bare ranges could be used as
conditions in if, while, and similar statements. You
could, for example, have written the previous code
fragment as

while gets
print if /start/../end/
end

This is no longer supported. Unfortunately, no error is
raised; the test will simply succeed each time.

Hope this answers your question.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,208
Messages
2,571,082
Members
47,683
Latest member
AustinFairchild

Latest Threads

Top