Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTim Forman
8,486 PointsIn the conditional statement 'lion' > 'zebra' why does the quiz say it's false?
In the quiz for comparison operators I receive an incorrect answer if I say the above statement is true. I thought it is comparing the first letter of the two words. If 'l' is before 'z' in the alphabet shouldn't the statement be true?
2 Answers
Joe Cochran
18,249 PointsThe opposite is true. Since 'zebra' comes after it is considered greater, just as 2 comes after 1.
'b' > 'a' evaluates to true since b comes later.
Hugo Paz
15,622 PointsHi Tim,
Its false because strings are compared in Lexicographical order. A simple explanation is that Z is farther away in the alphabet than L.