bodikp
July 19, 2007, 2:34pm
1
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.
bodikp
July 19, 2007, 2:40pm
2
Peter B. wrote:
pngthere = not File.exists?(“L:/png/#{pngdir}/#{pngfile}”)
in IRB. . . .
not File.exists?(“L:/png/#{pngdir}/#{pngfile}”)
works fine.
Try:
pngthere = !File.exists?(“L:/png/#{pngdir}/#{pngfile}”)
bodikp
July 19, 2007, 2:45pm
3
Alex Y. wrote:
Peter B. wrote:
pngthere = not File.exists?(“L:/png/#{pngdir}/#{pngfile}”)
in IRB. . . .
not File.exists?(“L:/png/#{pngdir}/#{pngfile}”)
works fine.
Try:
pngthere = !File.exists?(“L:/png/#{pngdir}/#{pngfile}”)
Ahhh, simple, of course. You’re a prince. Thanks !
bodikp
July 19, 2007, 2:48pm
4
On 7/19/07, Peter B. [email protected] wrote:
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>
bodikp
July 20, 2007, 5:00am
5
On 7/19/07, Peter B. [email protected] wrote:
doesn’t work in script. . . .
pngthere = not File.exists?(“L:/png/#{pngdir}/#{pngfile}”)
pngthere = (not File.exist?(‘pngfile’))
sayang:~/2 arie$ touch pngfile
sayang:~/2 arie$ irb
irb(main):001:0> pngthere = (not File.exist?(‘pngfile’))
=> false
irb(main):002:0>