From: George Koehler Date: 2012-01-17T07:09:16+09:00 Subject: [ruby-core:42157] [ruby-trunk - Feature #5899] chaining comparsions. Issue #5899 has been updated by George Koehler. =begin What is a good way to do chained comparison in Ruby? My best attempt, so far, is [1, 2, 3, 4].each_cons(2).all? {|a, b| a < b} =end ---------------------------------------- Feature #5899: chaining comparsions. https://bugs.ruby-lang.org/issues/5899 Author: Ondrej Bilka Status: Open Priority: Normal Assignee: Category: Joke Target version: 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 -- http://bugs.ruby-lang.org/