Computer Science Canada Operands of comparision operators must be scalar,sets or strings help |
Author: | dhyanp11 [ Wed Mar 09, 2016 10:49 am ] |
Post subject: | 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. |
Author: | Robotkubo [ Wed Mar 09, 2016 12:10 pm ] |
Post subject: | 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 |
Author: | Dreadnought [ Wed Mar 09, 2016 4:47 pm ] |
Post subject: | Re: Operands of comparision operators must be scalar,sets or strings help |
Robotkubo wrote: Really you need to remove the stars, because there isn't a reason for them... 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). |