if in csh

I am using this code

echo "opt_tpath = $opt_tpath"
if ($opt_tpath == 1) echo " -tpath = $Atpath\n"

and is giving

opt_tpath = 0
Atpath: Undefined variable.

Atpath should only be printed in opt_tpath == 1 but it still tries to print.

---------- Post updated at 10:05 AM ---------- Previous update was at 09:53 AM ----------

I think it's because it parses the whole line anyway AND EVALUATES IT!

BUGGER!!!!!!!!

That's because of CSH's "parser". See Csh Programming Considered Harmful and Top Ten Reasons not to use the C shell.