You are viewing a single comment's thread. Return to all comments →
Yeah, but what if a is equal to c?
if [[ $a == $b && $b == $c ]]
elif [[ $a == $b || $b == $c || $a == $c ]]
How about now?
Now it's perfect! ;)
It is not necessary.
If a == b, and b == c, that implies that a == c, by Transitive Property of Equality
You are right.
That's why there is no a==c part in the first if-clause.
Here we, however, are talking about the second elif-clause, ISOSCELES, and now, omitting a==c part makes it buggy.
if a==b and b==c is true and if a==c also happens to be true wouldn't that make it an equilateral triangle ?!
I would prefer to condition with Equilateral and Scalene triangles and rest of the conditions would lead to Isosceles by default ....
This edge case should be added to the problem. I did the same thing you did and passed. If I hadn't come in here afterward I never would have caught it.