
-----------------------------------
person
Wed Feb 02, 2005 4:52 pm

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


if whatdotcolor (40, 40) not= (44 and 1) then
    drawfilloval (40, 40, 35, 35, 1)
end if


-----------------------------------
cycro1234
Wed Feb 02, 2005 4:59 pm


-----------------------------------
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
Wed Feb 02, 2005 5:02 pm


-----------------------------------
ummm.....maybe 44 and 1 r colours?

-----------------------------------
Bacchus
Wed Feb 02, 2005 5:02 pm


-----------------------------------
thats not how u use and. you need to do
if whatdotcolor(x,y)not=color1 & whatdotcolor(x,y) not=color2 then

-----------------------------------
md
Wed Feb 02, 2005 5:03 pm


-----------------------------------
I'm not sure what cryo

-----------------------------------
person
Wed Feb 02, 2005 5:04 pm


-----------------------------------
so wat does turing think im trying to say when i use my previous code?

-----------------------------------
Bacchus
Wed Feb 02, 2005 5:05 pm


-----------------------------------
no idea im not turing

-----------------------------------
cycro1234
Wed Feb 02, 2005 5:06 pm


-----------------------------------
I don't think Turing understands that.

-----------------------------------
person
Wed Feb 02, 2005 5:08 pm


-----------------------------------
if it doesnt understand it, y does it still run?

-----------------------------------
cycro1234
Wed Feb 02, 2005 5:09 pm


-----------------------------------
Hey, I'm just a noob :(

-----------------------------------
person
Wed Feb 02, 2005 9:08 pm


-----------------------------------

if whatdotcolour (x,y) = (colour1 and colour2) then
       % stuff
end if


wat does this mean if it doesnt mean...


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
Wed Feb 02, 2005 9:30 pm


-----------------------------------
Well if it doesn't work, don't use it :)

-----------------------------------
person
Wed Feb 02, 2005 9:40 pm


-----------------------------------
y doesnt it work?

-----------------------------------
cycro1234
Wed Feb 02, 2005 9:42 pm


-----------------------------------
I dunno, ask some1 whose not n00bish.

-----------------------------------
TheZsterBunny
Wed Feb 02, 2005 11:57 pm


-----------------------------------
Turing is not like most other languages.
 
to compare a value to other values, you must use different statements.


if x=1 or x=5 then
%stuff
end if


also, perhaps you may wish to rephrase that statement.


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)--

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

-----------------------------------
Cervantes
Thu Feb 03, 2005 7:51 am


-----------------------------------
so wat does turing think im trying to say when i use my previous code?

Try the folllowing code:

put 44 and 1


:wink:

-----------------------------------
person
Thu Feb 03, 2005 1:06 pm


-----------------------------------
y does it output 0?

-----------------------------------
cycro1234
Thu Feb 03, 2005 1:53 pm


-----------------------------------
Doing :


put 44 and 100


Give me 36. Why is that?

-----------------------------------
TheZsterBunny
Thu Feb 03, 2005 7:01 pm


-----------------------------------
natural numbers.

and operator can compare two numbers bitwisely. 

The result is the natural number that is the bit-wise and of the operands.

i.e.
[syntax=turing]
var number : nat := 16#ABCD  %49381
var mask : nat := 16#FF % 255
put number and mask     % Outputs 205 (CD16)
[/syntax]

...yeah...

-Z

-----------------------------------
rizzix
Thu Feb 03, 2005 7:04 pm


-----------------------------------
I dunno, ask some1 whose not n00bish.

hey watch it.. shut up and post something productive. ur useless posts need to stop.. or we'll have to reduce ur ranke to lamer. and u dont want that happening.

-----------------------------------
Viper
Sat Feb 05, 2005 1:21 pm


-----------------------------------
y dont u jus

if whatdotcolor (x,y)not=44 or whatdotcolor(x,y)not=1 then
drawfilloval (x,y,r1,r2,colour)
end if

-----------------------------------
Bacchus
Sat Feb 05, 2005 3:14 pm


-----------------------------------
i think he wanted and not or :P and weve already told him that, he just wanted to kno y his didnt work also

-----------------------------------
Viper
Mon Feb 07, 2005 2:28 pm


-----------------------------------
yeah sry i didnt realize there were 2 pages lol  :oops:  :oops:

-----------------------------------
person
Mon Feb 07, 2005 5:19 pm


-----------------------------------
how could u have missed the 1st page??
and also if u only read the 2nd page....u well...wouldnt know wat the thread was talking about
