C Shell Scripting - HELP! - checking total args in a script

Hi, I 'm trying to learn the scripting language and am trying to create a script to open a C Program, allow the user to edit it, and then run it. What I have works but only when you enter the name to be compiled and the c program, but what if you only entered the 1 argument (cprogram.c) ? but I 'm trying to error check and got the problem if the user did not put 2 arguments in......the following is what I have :

#!/bin/csh

if ( ! -e $2 ) then
echo 'Error, the file does not exist..'
exit
else if ( ! -e $1 ) then
echo 'Error Please enter the file name to be compiled'
else if ( -e $2 ) then
gedit $2
gcc -o �1 $2
./$1
endif

Any experienced writers can help please?
Thank You:)

Do yourself a favour and learn a standard scripting shell. Csh is not recommended for anything more than trivial scripts. See these articles:

Top Ten Reasons not to use the C shell
C shell problems
Csh Programming Considered Harmful

Can anyone try to help me with this as it is still part of my coursework. Sorry I didn't mention it.

Homework postings are a against the rules
Thread closed.