+ 12
What is the difference between " = " and " == " ??
43 ответов
+ 61
= is assignment, like if you wanna assign x as 2, you do int x = 2.
== is comparison, if you wanna compare x and 2, you do if (x == 2), either true or false.
+ 8
"=" is an assignment operator which is used to assign value to the variable ex: int b=7;
"==" is a relational operator which is used to find the relation between two operands and returns in boolen value either 'true' or 'false' example: 5==5
Condition true
Returns 1 or true
+ 4
single `=` means you are giving the value
example a=2 and == means equal sign with this will returm is true or false example 1==1
+ 3
"=" is used to assign the value. Example: x = 2, then value of x is 2.
"==" is to show equality between values, Example x == y, here the value of y equal to x.
+ 3
= is used for assigning value eg- x=3 y=3
== is used for comparing whether the value is equal eg- if(x==y) comparing whether x is equal to y.
+ 3
= as in x=2 says give x the value of 2. Then on x's value will be two. This is an assignment operator as ot assigns x a value of two.
== as in if(x==2) checks whether x has a value of 2. this is a relational operator as it looks how two things are similar dissimilar of do they fall in the same category like if (x <2).
+ 2
first one is assignment operator, and second one is equal operator
+ 2
some compilers will warn you, but you need to be careful not to put something like "if (x=5)" since this will return true and assign 5 to x regardless of what x is.
+ 2
(=) is a Assignment Operators, for assigning a value to a variable.
(==) is a Relational Operators, checks the relationship between two operands.
Example:
x = 10; Now 10 is assign to the variable x.
5 == 10; checks whether the relation is equal or not.
+ 2
= also known as the assignment operator it assigns the value of its right hand side element to the value of its left hand side
.I. e
if a=b then the value of b is assigned to a
on the other hand == is used for the comparison of elements other than string types
+ 2
= is a assignment operator but == is logical operator
+ 1
= is used to assign value to a variable. the value can be number or alphabet , that depends on the programmer and the program.
And == is used to compare the value.
+ 1
= is nothing but assigning a value for a variable...for example a=5...this means that the value 5 is stored in memory location a...== is a relational operator...... means checks the equality of variables..i.e., checking whether the value belongs to that variable or not...
+ 1
this is an assignment operator
eg. i=5;
this is conditional operator
eg. if (i==5)
+ 1
= is known as asssingment operator used for Assing the number to variable while
== is used for comparison
+ 1
I think if you need the traditional equality sign that we use in maths, you should use "==", while if you want to set a variable like x to something, use the "=";
+ 1
the = is an assignment statement , the value on the left of it will get a new value that's the result of the right of it.
while the == is like asking if the right equals the left; and thus the answer will be yes or no..
+ 1
The '=' is the assignment operator, which assigns the value at the right hand side to the variable at the left hand side. Eg. x=4, here the value 4 is assigned to 'x'.
On the other hand, '==' is the relational operator which is used to check whether the value on both the sides are equal or not. If true, it returns a boolean true or '1' and if false, it returns a boolean false or '0'.
+ 1
"=" mean that we assign value to a variable. Ex x=5 or x=b+1 or a=false
"==" mean that we compare two values. Ex a=10 and b=20/2. Thus a==b.
+ 1
= for assigning
== for if statements