Computer Science Canada What Am I Doing Wrong!!!!!!!!!!!!!!!! Help!!!!!!!!!!! Urgent |
Author: | Krocker [ Wed Nov 03, 2010 4:52 pm ] |
Post subject: | What Am I Doing Wrong!!!!!!!!!!!!!!!! Help!!!!!!!!!!! Urgent |
Can some one help me, what am i doing wrong. i keep getting an error and i dont understand http://compsci.ca/v3/images/smiles/icon_question.gif . the following is my coding/program: import GUI setscreen ("graphics:550;150") % Tells what the button has to do procedure Simplepressed Sys.Exec ("Simple.exe") end Simplepressed procedure Compoundpressed Sys.Exec ("Compound.exe") end Compoundpressed % Gives the buttons a variable and creates the button var button1 : int := GUI.CreateButton (140, 60, 2, "SIMPLE", Simplepressed) var button2 : int := GUI.CreateButton (20, 60, 2, "COMPOUND", Compoundpressed) % Intro Statement to the program put "WELCOME TO KB INTEREST CALCULATOR" colour (3) put "PLEASE CHOOSE ONE OF THE FOLLOWING TYPES OF INTERESTS" loop exit when GUI.ProcessEvent end loop |
Author: | TerranceN [ Wed Nov 03, 2010 6:03 pm ] | ||||||
Post subject: | RE:What Am I Doing Wrong!!!!!!!!!!!!!!!! Help!!!!!!!!!!! Urgent | ||||||
Next time say what error you are getting, but I'm guessing you get the error: "Expression is not a procedure and hence cannot be called" I don't understand why, but from reading the documentation, they always use Sys.Exec in a if statement, which works properly. So instead of
use
which you can even use for error handling
Does anyone know specifically why you get that cryptic error? Why wouldn't Holtsoft just make it a procedure instead of having that error? |
Author: | TheGuardian001 [ Wed Nov 03, 2010 8:09 pm ] |
Post subject: | Re: RE:What Am I Doing Wrong!!!!!!!!!!!!!!!! Help!!!!!!!!!!! Urgent |
TerranceN @ Wed Nov 03, 2010 6:03 pm wrote: "Expression is not a procedure and hence cannot be called" I don't understand why, but from reading the documentation, they always use Sys.Exec in a if statement, which works properly Turing enforces the difference between Functions and Procedures. If the method is stated to return a value, you MUST use that value, whether it is by assigning it to a variable, using it in a conditional, etc. It's the same reason turing uses "exit when GUI.ProcessEvent()" instead of just "GUI.ProcessEvent" This specific method is a function because it returns a value indicating success/failure. I suppose they chose to do that because you're launching something outside of your own program, and will probably want to know if that program was successfully launched or not. |