Computer Science Canada wat is boolean? |
Author: | meidan [ Wed Jun 14, 2006 10:43 pm ] |
Post subject: | wat is boolean? |
when something doesnt work and boolean says on the buttom, what does that mean? |
Author: | MysticVegeta [ Wed Jun 14, 2006 11:00 pm ] |
Post subject: | |
Check the Turing Walkthrough for a complete explanation. var bool : boolean Simple declaration of a boolean. they hold true or false values, for eg: put 1=1. So thats true put 1=2. Thats false Could be interpreted as some other way: bool := 1=1 put bool (outputs true) bool := 1=2 put bool (outputs false) |
Author: | Ninja [ Wed Jun 14, 2006 11:16 pm ] |
Post subject: | |
Ya if you get an error at the bottom saying Warning something something and then it says it needs to be a boolean but run anyway, its usually when u assign your boolean variable with a : . For a boolean you have to assign like var x := 5 for example, but when ure actually assigning someting as a boolean you do var : <varname> := boolean. When you do a program where you read a text file and a user types stuff in and you have to write the code to find the item, thats where you use var found : boolean := false |
Author: | [Gandalf] [ Wed Jun 14, 2006 11:22 pm ] |
Post subject: | |
Why don't you give us an example of code which causes this to happen? Without that, it's hard to tell exactly what about 'boolean' you need help with. A general explanation is always good, but it will probably not be enough for you to understand your specific problem. Is the error message saying "if must be boolean type"? Or "boolean expression expected"? In that case, you will need to replace whatever you currently have with an expression that will return a boolean value. |
Author: | Ninja [ Thu Jun 15, 2006 9:01 am ] | ||
Post subject: | |||
here is the code i was talking about.
|
Author: | Clayton [ Thu Jun 15, 2006 9:20 am ] |
Post subject: | |
what is skip? you dont seem to have declared it, which may be what is causing your problem, also, i see that you are making your program a bit more dynamic by not using a hardcoded for loop, y not go all the way and use flexible arrays ![]() ![]() |
Author: | Ninja [ Thu Jun 15, 2006 4:20 pm ] |
Post subject: | |
skip is a built in command in turing |
Author: | MysticVegeta [ Thu Jun 15, 2006 7:04 pm ] |
Post subject: | |
More precisely, skip is a turing keyword. @SuperFreak: He was just demonstrating an example for booleans not on how to use arrays, I dont think it is hard coded at all, but it is "wrong" in a sense since he doesnt know there will be 10 things in the text file and with 11 files, it will cause an error of arrays. |
Author: | Ninja [ Thu Jun 15, 2006 7:47 pm ] |
Post subject: | |
I know what u mean bro, the problem was that when our teacher gave us that question, and actually all the array based questions, he specifically gave us the length of the array, thats why its hardcoded ![]() |
Author: | Clayton [ Thu Jun 15, 2006 9:12 pm ] |
Post subject: | |
well i learned something new today ![]() ![]() @Ninja: not to be mean or whatever, but why not surprise your teacher and show him what you have taught yourself and help other kids in your class? even if you have to make a version 2 to hand in (the one with the hardcoded values) just do one to show how much more dynamic that the proggie could have been ![]() |
Author: | Ninja [ Thu Jun 15, 2006 10:17 pm ] |
Post subject: | |
It's cool bro, i did that lol but he was like, nah im just gonna mark the other one.He is lazy like that lol. Thats why he takes 2 months to mark 3 chapters lol |
Author: | [Gandalf] [ Sat Jun 17, 2006 10:46 pm ] | ||||||
Post subject: | |||||||
skip just puts a newline wherever you put it. For example, the following are all equivalent:
|