The Differences' Between The Operator "==" And "="
Solution 1:
In python and other languages like C,
"="is a assignment operatorandis used to assign a value to a variable.
Example: a=2 # the value of a is2
whereas "=="is Comparison operatorandis used to check whether 2 expressions give the same value .Equality check returns trueif it succeeds andelsereturnfalse.
Example: a=2 b=3 c=2
a==b (#false because 2isnot equal to3)
a==c (#true because 2is equal to2)
Solution 2:
= is used for assignment: e.g.: apple = 'apple'. It states what is what. == compares one value to another. Is 5 equal to 5 should be written like this: 5 == 5
Solution 3:
An == expression evaluates to true, is an equality operator. == has the value of two operands are equal make the condition or statement true. = is an expression of assignment operator to the symbol of variables, arrays, objects.
Both operators are very important, and they work in different ways in every equivalent object. Their behavior in their operation is based on the identity of objects. Are reflation of their variables.
When using == in compares the values of two objects example having two cars from the same company and have the same identity and features and same looks.
The rule implies that the statement and condition to be trues To use = operator is when to evaluate variables in an expression if both sides of the operator mean same or the objects are same if not same its expression will be false and if true the expressions or objects are same.
Post a Comment for "The Differences' Between The Operator "==" And "=""