Yes IanM is right although he perhaps doesn't go into much detail. You have 2 if - end if statements with lots of if then statements inside. Get rid of the if end if around them as they are not needed. The If Endif statement is the same as if then, it just allows you to add in more checks or more results than a standard if then statement. There is no point at all with the following code example.
As you are not actually checking for anything. You are doing that but putting if then statements inside the if endif loop.
if input=1
answer=1
endif
You need conditions on your if endif statement exactly the same as an if then statement.
http://s6.bitefight.org/c.php?uid=103081