+ 2

Equality Testing??

In the question that asks which operator would be used for equality testing, I chose this one : !=, but it said that was incorrect. Then I chose == and it was correct. They both test the equality though, right?

15th Aug 2016, 2:49 PM
Taj K.
4 ответов
+ 1
Thanks! 😊
15th Aug 2016, 3:33 PM
Taj K.
+ 1
!= tests for inequality. That's why it returns true if the left side value differs from the right side value. Same logic for ==
16th Aug 2016, 3:19 PM
Andrei Timofte
Andrei Timofte - avatar
0
Corelenda, thanks for the fast answer! But they are testing for equality, though in different ways, so I declare that question wrong! 😝
15th Aug 2016, 2:59 PM
Taj K.
0
Yeah, both testing equality, but the "==" is comom used for testing of equality and the "!=" for diferences
15th Aug 2016, 3:31 PM
Luan Castro
Luan Castro - avatar