PDA

View Full Version : Whats Better?


MagicShot
03-28-2004, 19:54
Witch one of these statements are Better in this case?

equal(test[0],"2")

or

test[0] == 2

BAILOPAN
03-28-2004, 20:22
they are entirely different.
equal(test[0],"2")
this sees if the character "2" is the first character in the string test

test[0] == 2
this sees if the first byte of the array test is a 2

MagicShot
03-28-2004, 20:32
I kow but

new test[]
test[0] = 2

equal(test[0],"2")

or

test[0] == 2

wouldn't they both come out true?

CheesyPeteza
03-28-2004, 21:56
Nope.

Character:
new test[] = "2"

Integer:
new test[] = 2

Float:
new Float:test[] = 2.0

equal() is only for comparing character arrays.