| Lone Lobo - Nov-16-2006 server time |
| You have some major problems. The End If doesn't need to go directly after the if statement. It goes after all what should happen if the conditions of that if statement are "true". Say: if 1+1=2 then put "1+1=2" end if if 1+1=3 then put "1+1=3" end if 1+1=2, obviously, so on the output screen you'd see "1+1=2". 1+1 doesn't equal 3, obviously, so all the code inside that if statement is skipped completely. Also, about elsif: if 1+1=2 then put "Hi!" elsif 2+2=4 put "Hello!" end if elsif needs to be nested inside an existing if statement, and it acts exactly as an else statement, and an if statement. |
| vahnx - May-19-2006 server time |
| You need a variable at the top of your program called answer: var answer : string And why is your program all spaced out and stuff? Instead of elsif, use if. Elsif's have to be inside an if statment, like follows: if x = 1 then put "hi" elsif x = 2 then put "hello" end if You cant have: if x = 1 then put "hi" end if elsif x = 2 put "hello" |
| Treflips - Apr-27-2006 server time |
| My end when things ,don't have a loop ontop of it do think that might be causing my problem? |
| Furball - Apr-27-2006 server time | ||
Yup, your statements are either missing, or not constructed properly. Possible reasons is you might have an elsif statement that is outside a condition statement or does not have a parent if statement. Remember that in conditional statements, you cannot use elsif without a primary "if condition then" statement. The second error suggests that you closed your loop before you closed your if statement. You might have added them in, but they are in the wrong order. Also, exit when can only be used while you are inside a loop. Exit when is a special condition where you immediately exit the loop you are in, if the statement evaluates as being true. Exit when will not jump you out of conditional statements. |
| Treflips - Apr-27-2006 server time |
| I'm getting these but more like 9 messages. elsif without matching if syntax error at if expected end loop exit can be used only in a loop ir for statement |
| Furball - Apr-27-2006 server time |
| What error is the program giving you? |
| Treflips - Apr-27-2006 server time |
| I have no idea where I'm missing the closing statements, after I add that in and take out the extra end if will my program run? BTW thanks for the help. |
| Furball - Apr-27-2006 server time | ||
That's a bit better, but you're still missing some closing statements
Your conditional statement is constructed incorrectly. It should be like this: if condition then elsif condition then end if The way elsif works is it's a part of the same conditional statement. Seeing as it's part of the same statement, you don't need to end if each elsif statement (In this language at least). Think of it this way: if condition then % %comments....to show spacing % % elsif condition2 then % % % % elsif condition3 then % % % % end if See how I only used one end if for that whole statement? This is due to the fact that elsifs are sub-conditions to the "main" condition. If your first condition fails, it checks your next elsif, if that fails, checks the next, and so on. Your program uses alot of loop and conditional nesting (loops inside loops inside loops, or if's inside if statements inside if statements) which can be a good thing, but the more nested your program becomes, the more complex it can be to read (especially if there's an error somewhere). Also, make sure at the end of your program, you close your loops. Same idea goes for loops: loop % %Content in here <--- % end loop for each loop, you need to close it, just like if statements. |
| Treflips - Apr-27-2006 server time | ||
Okay, how about I fill the end if and then tell me what am I still doing wrong because I did that before and still didn't run.
|
| Furball - Apr-27-2006 server time |
| Sorry, I don't rewrite other people's coding. You'll learn the language better if you code it yourself. Debugging is a part of programming and even though it can be a pain in the ass, you learn from your mistakes. What I suggest to do is attempt at closing those opened statements. Make a count of how many IF statements you have, write them down, and while reading your program, if you come across the place where your statement should have ended, insert your "end if" statement and scratch that number off your list. If that doesn't work, you can try commenting out the portion of your program that's causing problems and concentrate on creating the conditions before adding the content into your statements. Example If condition then if condition 2 then end if if condition 3 then else if condition 4 then end if end if Create the bones of the statement then you can just copy and paste your content in between afterwards. Hope this helps. |
| Treflips - Apr-26-2006 server time |
| If possible can you do it for me please and post it back here, I alreayd tried putting end if after everytime I use an if statement and still it doesn't work. edit: or you could just tell me the excat place to put end if. |
| Furball - Apr-26-2006 server time |
| You need to close your conditional statements. You left at least 10 of them opened. Whenever you open a statement such as: If condition then you need to close it with end if same idea with loops. If you don't close them, you'll get a syntax error and you'll have a hell of a time finding which statement you forgot to close. Best programming practice is to write the bare bones of your statements before you fill them with code: Example If (your condition here) then end if then you don't have to worry about syntax errors due to forgetting to close your statements. |
| Treflips - Apr-26-2006 server time | ||
Okay my program doesn't run can someone help me?
Can someone fix it up and post it back here please? |