What is this error?

So I was working on the editor, and I got an error. I got this.

No and, or, xor, not, if, in
in the name


That one new to me...
Do you have a variable or attribute that starts with and_, or_...?
Like:
and_go_north...?
or_not_this...?


No.
It says the name of an object can't be/can't have "and, or, xor, not, if, in".


I’m confused. It sounds like you know what the problem is. You get that message if you try to put one of those words in an object name. The work around is that you can put one of those words in an alias name.


@XanMag I thought someone could tell me why. Especially xor.


K.V.

image


https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/xor-operator


xor checks to make sure ONLY ONE of the statements is correct, not both.


This will print the message:

game.true = true
game.false = false
if ((game.true) xor game.false) {
  msg ("The <code>xor</code> message printed!")
}

This one will not print the message because both statements are correct:

game.true = true
game.false = false
if ((game.true) xor not game.false) {
  msg ("The <code>xor</code> message printed!")
}

Imagine you've got an object in your game called black and white cat.

if (black and white cat.dead) {
Are we checking if black and white cat has been killed? Or are we checking that white cat is dead, and a variable black is true?

The computer can't tell. The only way to make it clear is to say you can't use and or or etc. in object or variable names.

(Most languages avoid the issue by not allowing spaces in names. But that would be the easy way…)


(as mrangel said/explained, you're confusing the parser/compiler, on how to correctly read your code)

(programming/circuitry) logic/boolean operators/operations (phil: symbolic language/logic):

https://en.wikipedia.org/wiki/Truth_table

https://en.wikipedia.org/wiki/Logic_gate

https://courses.umass.edu/phil110-gmh/MAIN/IHome-5.htm
https://courses.umass.edu/phil110-gmh/text/c02.pdf

// DEF/ID (definition/identity, lol, not an actual logic operator, lol):

// true = TRUE
// false = FALSE

NOT (negation: opposite/inverse/complement):

not true = FALSE
not false = TRUE

AND:

false and false = FALSE
false and true = FALSE
true and false = FALSE
true and true = TRUE

NAND (Not AND):

false nand false = TRUE
false nand true = TRUE
true nand false = TRUE
true nand true = FALSE

OR:

false or false = FALSE
false or true = TRUE
true or false = TRUE
true or true = TRUE

NOR (Not OR):

false nor false = TRUE
false nor true = FALSE
true nor false = FALSE
true nor true = FALSE

XOR (eXclusive OR):

false xor false = FALSE
false xor true = TRUE
true xor false = TRUE
true xor true = FALSE

XNOR (Not eXclusive OR --- ya, a bit confusing --- for me anyways, in their switching of its order, lol):

false xnor false = TRUE
false xnor true = FALSE
true xnor false = FALSE
true xnor true = TRUE


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums