Project

General

Profile

Actions

Feature #5899

closed

chaining comparsions.

Added by neleai (Ondrej Bilka) over 12 years ago. Updated almost 8 years ago.

Status:
Rejected
Target version:
-
[ruby-core:42149]

Description

Migration from python to ruby is problematic because ruby lacks certain features.
Most important python advantage is chained comparison
We must wrap every comparison like described below.

puts "yes" if 1<2<3<4

class Fixnum
  def <(a)
    ((self<=>a)==-1)&&a
  end
end
class FalseClass
  def <(a)
    false
  end
end
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0