mardi 26 mai 2020

What's the difference between: `a == b == c` and `a == b && a ==c`? [duplicate]

Hi I am trying to check if three values in a 2d array are the same.

I wanted to do this using the following statement:board[0][i] == board[1][i] == board[2][i].

Unfortunately this gave me false as an answer, but the following statement result in true: board[0][i] == board[1][i] && board[0][i] == board[2][i]

I can't figure out why, any ideas?

Aucun commentaire:

Enregistrer un commentaire