Posts

Post not yet marked as solved
2 Replies
868 Views
(1, "zebra") < (2, "apple") // true because 1 is less than 2; "zebra" and "apple" are not compared(3, "apple") < (3, "bird") // true because 3 is equal to 3, and "apple" is less than "bird"(4, "dog") == (4, "dog") // true because 4 is equal to 4, and "dog" is equal to "dog"In the example above, you can see the left-to-right comparison behavior on the first line. Because 1 is less than 2, (1, "zebra") is considered less than (2, "apple"), regardless of any other values in the tuples. It doesn’t matter that "zebra" isn’t less than "apple", because the comparison is already determined by the tuples’ first elements. However, when the tuples’ first elements are the same, their second elements are compared—this is what happens on the second and third line.Why is Zebra not less than apple, and apple is less than bird ? How do you know this, do you count the letters ? or how is it done ? What is the criteria to determine ?
Posted
by Protium01.
Last updated
.