the 'if' method

there is special syntax for 'if'. it could be expressed instead as a method that takes a value and a block then optionally executes the block. a=1 if a > 0 b=2 end /typo:code

defining an 'if' method works fine but it turns out to be more intuitive to call the method 'true?'.

a=1 (a>0).true? do b=2 end /typo:code

a similar method, 'false?', could be defined to replace 'unless'. i think this has potential. someone on #ruby-lang wrote the 'if' method, i renamed it to 'true?'.

class Object def true? yield end end

class FalseClass def true? end end

class NilClass def true? end end /typo:code

what is missing is else. a method would have to support receiving two blocks for else to be easily implemented.