From: Me Me Date: 2008-10-24T20:19:00+09:00 Subject: Re: Bound macro in ruby thanks for answering: in my case it's something I can easy implement with if-clause, but I wanted to know if this could be done in one single line def bound(min, value, max) if(value > max) return max end if(value < min) return min end return value end Robert Klemme wrote: > 2008/10/24 Me Me : >> I think it's a simple question but I couldn't find in docs. >> Is there a macro already defined in ruby for returning the "bound" of a >> value: >> >> ex: >> >> BOUND(1, 5, 10) => 5 >> BOUND(10, 5, 100) => 5 >> BOUND(1, 50, 10) => 10 > > First of all, there are no macros in Ruby. If anything you would be > looking for a method (or function). How is your "bound" defined? > > Cheers > > robert -- Posted via http://www.ruby-forum.com/.