Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 weird problem with if statement
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
person




PostPosted: Wed Feb 02, 2005 4:52 pm   Post subject: weird problem with if statement

y doesnt this work?
its supposed to check if a dot's colour is 1 or 44, and if its not 1 or 44 then draw a circle there

code:

if whatdotcolor (40, 40) not= (44 and 1) then
    drawfilloval (40, 40, 35, 35, 1)
end if
Sponsor
Sponsor
Sponsor
sponsor
cycro1234




PostPosted: Wed Feb 02, 2005 4:59 pm   Post subject: (No subject)

why do u have

if whatdotcolor (40, 40) not= (44 and 1) then


the and there?? its:

if whatdotcolor (40, 40) not= *insert colour here*
person




PostPosted: Wed Feb 02, 2005 5:02 pm   Post subject: (No subject)

ummm.....maybe 44 and 1 r colours?
Bacchus




PostPosted: Wed Feb 02, 2005 5:02 pm   Post subject: (No subject)

thats not how u use and. you need to do
code:
if whatdotcolor(x,y)not=color1 & whatdotcolor(x,y) not=color2 then
md




PostPosted: Wed Feb 02, 2005 5:03 pm   Post subject: (No subject)

I'm not sure what cryo
person




PostPosted: Wed Feb 02, 2005 5:04 pm   Post subject: (No subject)

so wat does turing think im trying to say when i use my previous code?
Bacchus




PostPosted: Wed Feb 02, 2005 5:05 pm   Post subject: (No subject)

no idea im not turing
cycro1234




PostPosted: Wed Feb 02, 2005 5:06 pm   Post subject: (No subject)

I don't think Turing understands that.
Sponsor
Sponsor
Sponsor
sponsor
person




PostPosted: Wed Feb 02, 2005 5:08 pm   Post subject: (No subject)

if it doesnt understand it, y does it still run?
cycro1234




PostPosted: Wed Feb 02, 2005 5:09 pm   Post subject: (No subject)

Hey, I'm just a noob Sad
person




PostPosted: Wed Feb 02, 2005 9:08 pm   Post subject: (No subject)

code:

if whatdotcolour (x,y) = (colour1 and colour2) then
       % stuff
end if


wat does this mean if it doesnt mean...

code:

if whatdotcolour (x,y) = colour1 and whatdotcolour (x,y) = colour2 then
       % stuff
end if


i know its not an error because turing actually runs it
cycro1234




PostPosted: Wed Feb 02, 2005 9:30 pm   Post subject: (No subject)

Well if it doesn't work, don't use it Smile
person




PostPosted: Wed Feb 02, 2005 9:40 pm   Post subject: (No subject)

y doesnt it work?
cycro1234




PostPosted: Wed Feb 02, 2005 9:42 pm   Post subject: (No subject)

I dunno, ask some1 whose not n00bish.
TheZsterBunny




PostPosted: Wed Feb 02, 2005 11:57 pm   Post subject: (No subject)

Turing is not like most other languages.

to compare a value to other values, you must use different statements.

code:

if x=1 or x=5 then
%stuff
end if


also, perhaps you may wish to rephrase that statement.

code:

if whatdotcolor(x,y)_ ~= color1 and whatdotcolor(x,y) ~= color2 then
% stuff
end if


What you have doesn't make sense to turing. you are comparing the value of (whatdotcolor(40,40)) to (44 and 1). NOT them individually, but together. -- Bad!

another way (if you want)--
code:

if whatdotcolor(40,40) = 44 or whatdotcolor(40,40) = 1 then
%its bad!
else
%its good!
end if



but that'll probably get you yelled at.

-Z
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 24 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: