[Tutor] Discussion about Chaining in comparison operators
Manprit Singh
manpritsinghece at gmail.com
Tue Oct 6 13:32:45 EDT 2020
Dear sir ,
Let's start with a problem: I have 3 variables a,b, c and all three are
assigned some integer values .
a = 5
b = 7
c = 6
now if i have to check that if all three are equal or not, what should i
prefer from the below given choices :
1) a == b and a == c
or it chained version
b == a == c
2) a == b and b == c
or its chained version
a == b == c
Since a == b == c seems more readable than b == a == c, I will prefer
this .
Regards
Manprit Singh
More information about the Tutor
mailing list