On 7/19/07, Peter Bailey <pbailey / bna.com> wrote:
> Hello,
> I want to create a boolean variable for a "not" statement. When I do a
> "not File.exists?" in IRB, it works fine. But, it doesn't work when it's
> part of a variable declaration. Can someone help me to create a truth
> variable for a statement like this?
>
> Thanks,
> Peter
>
> doesn't work in script. . . .
>    pngthere = not File.exists?("L:/png/#{pngdir}/#{pngfile}")
>
> in IRB. . . .
>    not File.exists?("L:/png/#{pngdir}/#{pngfile}")
> works fine.

sayang:~/2 arie$ irb
Arigatou jyanai! Pizza wa (2) ni-mai, OK!
Terima kasih boleh2 saja, pizza+hotel_empuk itulah yg lebih dari boleh2 saja
irb(main):001:0> File.exists?('1.tcl')
=> true
irb(main):002:0> !File.exists?('1.tcl')
=> false
irb(main):003:0> "a" unless File.exists?('1.tcl')
=> nil
irb(main):004:0> puts "a" unless File.exists?('1.tcl')
=> nil
irb(main):005:0> puts "a" if File.exists?('1.tcl')
a
=> nil
irb(main):006:0> tclthere = !File.exists?('1.tcl')
=> false
irb(main):007:0> tclthere2 = not File.exists?('1.tcl')
SyntaxError: compile error
(irb):7: syntax error, unexpected kNOT
tclthere2 = not File.exists?('1.tcl')
               ^
        from (irb):7
        from :0
irb(main):008:0>

-- 
Arie || ariekeren, http://ariekusumaatmaja.wordpress.com
http://groups.yahoo.com/groups/id-ruby
"Never say RTFM. Turn the trolls into committers", Audrey Tang -
conisli-ofun.pdf