0
What does this symbol mean ? ==
==
5 Answers
+ 1
when you want to assign a variable, use =
but in if, elif, while, else, for loops use== to make the computer check whether the L.H.S = R.H.S
+ 2
Sahil Danayak You don't need an if-alike statements or conditional loop to use ==. Example:
int
isEqual (int a, int b) {
return (a == b);
}
void
sillyFunc (int a, int b) {
std::string answ[2];
answ[0] = "No!\n";
answ[1] = "Eeeyup.\n";
std::cout << "Are a & b equal?\n";
std::cout << answ[(a==b)];
}
I'll leave arrays of function pointers to the imagination.
+ 2
I am sorry but the question is about python
+ 1
Gawd I wish people would specify language(s) in the title. I mean I don't read tags because they're full of trash, eg: "this" "what" "does" "mean" ...
Anyway, I'm 99% sure my C++ example translates to Python. The point was to illustrate that == is an operator like + or - and not _necessarily_ to do with keywords (if, for, etcetera).
0
To check value is equal or not