
-----------------------------------
Namis
Thu Sep 11, 2003 2:56 pm

Problem with Code - Help Please
-----------------------------------
var one : string
var two : string
put " Yes or No? "
if one = "Yes" then
    put " Good Choice! "
elsif two = "No" then
    put " Bad Choice! "

im getting 1 error, what is wrong with this?

-----------------------------------
Namis
Thu Sep 11, 2003 3:20 pm

Different Code
-----------------------------------
put " hello " ..
put " What is your name? "
put " my name is Andrew. "
put " How are you today? "
var fine : string
get fine
put " Well, Im doing Good " ..
put " Not exactly ", fine ..
put " though "
var game : string
var Yes : string
put " Want to play a game? " ..
put " Yes or No "
get game
if game = Yes then
put " Cool, lets play a game! "

else 
put " Ok You dont want to play a game then "

end if

- OK This code works fine, but after user answers Yes/No, it finishes the program without saying " Lets play, or OK you dont want to play "

What am i doing wrong?? Any Help would be appreciated

-----------------------------------
Archi
Thu Sep 11, 2003 4:01 pm


-----------------------------------
When using if statements involving variables which are strings u need to include the " "....So the code for this which works will be:

put " hello " ..
put " What is your name? "
put " my name is Andrew. "
put " How are you today? "
var fine : string
get fine
put " Well, Im doing Good " ..
put " Not exactly ", fine ..
put " though "
var game : string
var Yes : string
put " Want to play a game? " ..
put " Yes or No "
get game
if game = "Yes" then
    put " Cool, lets play a game! "

else
    put " Ok You dont want to play a game then "

end if[/b]

-----------------------------------
Namis
Thu Sep 11, 2003 6:11 pm

Thanks
-----------------------------------
Much Appreciated, ill give it a try now

-----------------------------------
Namis
Thu Sep 11, 2003 6:18 pm


-----------------------------------
This is what i got now, It works fine ( if i take the "No" Part out. )

[/code]put " hello " ..
put " What is your name? "
put " my name is Andrew. "
put " How are you today? "
var fine : string
get fine
put " Well, Im doing Good " ..
put " Not exactly ", fine ..
put " though "
var game : string
put " Want to play a game? " ..
put " Yes or No "
get game
if game = "Yes" then
put " Cool, lets play a game! "

elsif No = "No" then                      