|
|
AWEstun
|
AWEstun
|
If this works:
if ($read(name.txt,w,$1 $+ *) = $null) {
why won't this work:
if (!$read(name.txt,w,$1 $+ *)) {
???
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
remove the space between the ! and $read
|
|
|
|
AWEstun
|
AWEstun
|
Uhm, there is no space between ! and $read
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
ok.. maybe it's this board, but to me it looked like there is.. the other possibility that I can see is that your search isn't returning a response that matches $null.. I noticed that you're doing the 2nd comparison with a different file than the first, so is it possible that the second file has a match for your search?
|
|
|
|
AWEstun
|
AWEstun
|
It should be the same filename.
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
hmm.. looking at your original post now, it is using the same filename.. I could've sworn it wasn't earlier.. in any case, if all of the parameters are the same, then the !$read should work
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
First of all, when doing a comparison that is equal, you should be using == and not =.
Beyond that, keep in mind that the first one only is true if the result is $null. The second one is true when the result is $null, 0, or $false. The 0 can often cause issues for people who try doing it this way instead of using == $null.
|
|
|
|
AWEstun
|
AWEstun
|
if (!$read(name.txt,w,$1 $+ *)) {
is working now.
|
|
|
|
Joined: Oct 2003
Posts: 3,641
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,641 |
I'll bet this had nothing to do with your syntax and everything to do with what $read was returning.. ie. it wasn't finding anything in the file. There's a good debugging tutorial at http://kthx.net/ftb which may cover how to tackle problems like these in the future.
|
|
|
|
|
|