Jules Jacobs wrote: >Hi, I have a question about Ruby if constructs. Why aren't they like >smalltalk if's, where you have a boolean class and two subclasses: true >and false. They both have these methods: ifTrue and ifFalse. If you use >a block with a ifTrue on a True object, it will be yielded. If you use >it on a false object, nothing will happen. > >So in ruby code: > >true.if_true do >#code will be executed >end > >and: >false.if_true do >#code will NOT be executed >end > >and if_false is available too. > >so you can do this too: > >(var == 'a').if_true do >puts 'var = "a"' >end > >I know it would be difficult to do an if-else thing with this because >the return value from the block would be the receiver: > >(var == 'a').if_true do > puts 'var = "a"' >end.if_false do > #code >end > >So is this the reason for if(var == 'a') not being syntactic sugar for >(var == 'a').if_true? > >Thanks for answering! > >Jules > > > What would be the point of creating another smalltalk like language? smalltalk is still active as far as I can tell, so if you like smalltalk, why not use that instead of ruby? I don't want the ifs to be like smalltalk if. I want standard ifs.