
-----------------------------------
dhyanp11
Wed Mar 09, 2016 10:49 am

Operands of comparision operators must be scalar,sets or strings help
-----------------------------------
get name : *
loop
    put "Ok ", name, ". Do you want to play the guessing game?"
    get firstanswer : *
    exit when firstanswer = "yes" or firstanswer = "Yes" or firstanswer = "y"
    put
        " Invalid! Let's try this one more time."
    if firstanswer = "no" or firstanswer = "No" or firstanswer = "n" then
        quit
    end if
end loop


I am not sure what the error means.

-----------------------------------
Robotkubo
Wed Mar 09, 2016 12:10 pm

RE:Operands of comparision operators must be scalar,sets or strings help
-----------------------------------
Really you need to remove the stars, because there isn't a reason for them... also you haven't set a variable for the name and firstanswer and you'll need to set them to strings. Should look like this

var name : string
var firstanswer : string

get name
loop 
put "Ok ", name, ". Do you want to play the guessing game?" 
get firstanswer 
if  firstanswer = "yes" or firstanswer = "Yes" or firstanswer = "y" then
put 
"Invalid! Let's try this one more time." 
end if
if firstanswer = "no" or firstanswer = "No" or firstanswer = "n" then 
quit 
end if 
end loop

-----------------------------------
Dreadnought
Wed Mar 09, 2016 4:47 pm

Re: Operands of comparision operators must be scalar,sets or strings help
-----------------------------------

Really you need to remove the stars, because there isn't a reason for them...
I disagree, if you want to allow the user to enter a first and last name separated by a space (this appears to be the intent) then this is a good way of doing so.


As for your issue dhyanp11, Robotkubo is correct, you need to define your variables before you use them (the section "Constants and Variables" of http://compsci.ca/v3/viewtopic.php?t=9634 may help).
