Computer Science Canada

If statement, needs a boolean type

Author:  HaVoC [ Wed Nov 12, 2003 4:08 pm ]
Post subject:  If statement, needs a boolean type

I'm trying to make a simple calculator. Just with 2 numbers and 4 operations. +,-,*,/

My if statement is this

if
op:= +
ans:= num1+num2
end if

Except it says my if statement needs type boolean? What do I do?

Author:  Mazer [ Wed Nov 12, 2003 5:18 pm ]
Post subject: 

HaVoC wrote:

Except it says my if statement needs type boolean? What do I do?

it says it needs type boolean because if statements use boolean (true or false) comparisons and execute a specified section of code if it is true and another section of code (if specified) if it's false.

:= is for assigning values to variables
= is for comparing variables

thus, your if statement should read:
code:

if op = "+" then
    ans := num1+num2
end if

thats assuming your code has a string variable called op that you use to get input from the user ("+", "-", "*", "/")

Author:  Chimaera [ Wed Nov 12, 2003 7:37 pm ]
Post subject: 

Quote:
thus, your if statement should read:
Code:

if op = "+"
ans := num1+num2
end if


You mean
code:

If op = "+" then
ans:=num1+num2
end if


Wink

Author:  Mazer [ Wed Nov 12, 2003 8:13 pm ]
Post subject: 

lol, what are you talking about, chimaera? you shouldn't go around quoting people and then changing the text in the quote. Wink

Author:  Chimaera [ Wed Nov 12, 2003 8:17 pm ]
Post subject: 

What?! Me change words around?!

I may be old, blind, a communist, stupid and change words around while you're not looking but I'm not a porn star! XD


I spy with my little eye
Quote:
Last edited by Mazer on Wed Nov 12, 2003 8:11 pm; edited 1 time in total

Author:  Mazer [ Wed Nov 12, 2003 9:13 pm ]
Post subject: 

man... there needs to be a "shifty eyes" emoticon or something... i mean... i um.. well you see i... Shoting

Chimaera wrote:

I may be old, blind, a communist, stupid and change words around while you're not looking but I'm not a porn star! XD


liar! i saw the pictures! i saw the movies! i saw the used condoms! (P.S. ewww)

Author:  compudave [ Wed Nov 12, 2003 11:05 pm ]
Post subject: 

Mazer wrote:
liar! i saw the pictures! i saw the movies! i saw the used condoms! (P.S. ewww)


Laughing lmao, funny but dude that's gross... Laughing

Author:  HaVoC [ Thu Nov 13, 2003 11:07 am ]
Post subject: 

Ok, well, I fixed it before I looked at this post. My tech teacher helped me out. Anyways, thanks, it helped in the long run. Though I had to set the ans variable to 'real' before I could do division. Can anyone tell me how to go about making an interface?

Author:  Chimaera [ Thu Nov 13, 2003 9:06 pm ]
Post subject: 

what sort of interface are you looking for? GUI? Text? Or do you want there to be boxes that you click on and text boxes for you to type in?

Author:  HaVoC [ Thu Nov 13, 2003 9:38 pm ]
Post subject: 

Well, a GUI would be nice, but before I do that, what is the code to implement a BMP?

Do you know a place, with a list of ALL commands, and their descriptions?

Author:  AsianSensation [ Thu Nov 13, 2003 9:46 pm ]
Post subject: 

it's called the turing help files, lol Laughing

F10 button

Author:  Tony [ Thu Nov 13, 2003 9:47 pm ]
Post subject: 

there's a tutorial on importing pictures into turing in TUTORIALS section. As for all commands... help file (F10 in turing) is helpful at times.

Author:  HaVoC [ Fri Nov 14, 2003 9:32 pm ]
Post subject: 

All that did was enable tracing

Author:  Dan [ Mon Nov 17, 2003 4:42 pm ]
Post subject: 

HaVoC wrote:
All that did was enable tracing


I dont what verson of turing you have but in all the ones i have used have F10 bring up the help file if they have it and the F9 birngs up the help file for the slected worad.

if you have one of the erail versons of turing 4.x you may have to get the upgrade from the holth group web site to get the help files

Author:  HaVoC [ Tue Nov 18, 2003 8:46 pm ]
Post subject: 

What's the Holth Group URL?

Author:  Thuged_Out_G [ Tue Nov 18, 2003 8:56 pm ]
Post subject: 

www.holtsoft.com

i think thats it


: