exit value of the last run

I want to get the exit value of the last run.
I thought I can use the argument "$?" which supposed to hold the value but I get a syntax error.
Is there another way?
Thanks

$? works for sh, ksh, bash, etc...

Are you using csh? If so try $status

Thanks !!!