Computer Science Canada

I need help with boolean it wont run it

Author:  Jesse Kazemi [ Mon Jun 16, 2014 5:14 pm ]
Post subject:  I need help with boolean it wont run it

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>


What is the problem you are having?
<Answer Here>


Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>

Author:  Tony [ Mon Jun 16, 2014 7:12 pm ]
Post subject:  RE:I need help with boolean it wont run it

There's a preview bug that cleared the post, but I'll guess it has something to do with your post in another thread:
code:

var answer : boolean
put "Did Jesse go to take the literacy test? True or false?"
get answer
if false then
  put "Ima smack you for thinking of me that way u fool of a took!"
  if true then
    put "Bravo esavo"
    put "Did Jesse pass the literacy test? True or false?"
    get answer
    if false then
      put "Are you bright I did pass it you 'hodog ' russell peters saying!!!"
      if true then
        put "Your a goofy goober you got it right!"
      end if


For indepth look at the if statements, follow tutorial links from The Turing Walkthrough.

It looks like there's a confusion between boolean values, string literals "true" and "false", and boolean expressions. It might help to prompt user replies as "yes/no" instead.

code:

var answer : string
answer := "yes"
if answer = "yes" then
  put "it was yes"
else
  put "it was something else"
end if

Author:  Jesse Kazemi [ Tue Jun 17, 2014 11:15 am ]
Post subject:  Re: I need help with boolean it wont run it

Thanks so much tony for the help

Author:  Jesse Kazemi [ Tue Jun 17, 2014 2:32 pm ]
Post subject:  Re: I need help with boolean it wont run it

50 views and no replies


: