Renald Buter
6/17/2005 8:48:00 AM
On 17:44 Fri 17 Jun , G?bor SEBESTY?N wrote:
> I have this very simple example:
>
> a = 1
> b = nil
> puts a.nil?
> puts b.nil?
> puts "ok" unless a.nil? and b.nil?
>
> Running it results these:
>
> false
> true
> ok
>
> Why the third answer is ok? Unless false and true => false ..
Just look carefully and mind that 'unless' is equivalent to 'if not'
a.nil? => false
b.nil? => true
false and true => false
if not false => if true
Regards,
Renald