- 2
Why "=="?
"The operator "=" will not work as expected because it serves to attribute value." Then, use == to equality comparison.
7 Answers
+ 5
= is an assignment operator already.
Unless you wanna make assignment operators "->" gor example
+ 3
Thanks all:)
+ 2
Hello Jaqueline,
Your name sounds familiar to me.. so I'll to take the risk of answer you in Brazilian Portuguese, okay ?
But if others are reading this question and also wanna know the answer, the operator " == " is a boolean expressions and compare if something ia true or not. You can read this:
___(A)_____ == _____(B)______:
If was true that (A) is equal (B) ... than: (do s something).
The operator " = " is common used to define something.
example
number = int (2)
print (number)
>>>> 2
~~~~~~~~~~~~~~~~~
Oi Jaqueline,
Seu nome soa familiar, então eu vou me arriskar respondé-la em Portugues do Brazil, tudo bem ?
O operador == é para comparar sentenças, ele responde se o valor é verdadeiro ou falso.
Lembra de lĂłgica ?
Nem todo mundo estuda isso, mas os operadores == tem a função de comparar o valor lógico da sentença.
Isso Ă© muito Ăștil quando vocĂȘ precisa tomar decisĂ”es em cima de outras dependentes do "input" ou da resposta do usuĂĄrio.
+ 2
if u want to know why ==
its a syntax / thought
u can take it as below :
suppose its in code -
if a==h :
do this
now compiler will check if the value of a and h are equal...
so first qual to check a's value next for h's value...
like this
a=5=h....
interpreted as a==h..
now as it is a syntax provoked by a certain direction of thought of how check two values its not 100% logical to everyone..
+ 1
this is so because this is a c++ there =karna assignment and == means giving a particular value .
0
=
is assigning operator to assign value
it works from right to left
x=4
4(right) is assigned to x(left)
== is checking operator for values / types both for rhs and lhs
0
Hiii