Forum: Ruby Re: Smalltalk's favorite Boolean method

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Berger, Daniel (Guest)
on 2006-04-11 17:47
(Received via mailing list)
> For a long time I have been programming Smalltalk.
> Recently, Ruby "got me" and I was wondering how the
> famous ifTrue:ifFalse: could be added to the System.
>
> 1 = 2
>   ifTrue:
>    [Transcript show: "true!" ]
>   ifFalse:
>    [Transcript show: "false!"]

How is this effectively different than:

if 1 == 2
   puts "true!"
else
   puts "false!"
end

???

Dan
unknown (Guest)
on 2006-04-11 18:03
(Received via mailing list)
On Tue, 11 Apr 2006, Berger, Daniel wrote:

>> For a long time I have been programming Smalltalk.
>
> if 1 == 2
>   puts "true!"
> else
>   puts "false!"
> end

or even

   1 == 2 ?
     puts('true'):
     puts('false')

lean.  mean.  ;-)

-a
This topic is locked and can not be replied to.