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 trial

Ruby Ruby Operators and Control Structures Ruby Operators Greater Than

Why "a" > "b" is wrong? Do I have some misunderstanding about the question?

As the title.

"a" > "b"

2 Answers

You are comparing 2 strings.

And "a" is not greater than "b" because it comes after the a.

The best way is to compare the ASCII values for those 2 chars:

"a" has a decimal value of 97 and "b" has "98" meaning that 97 is not greater than 98 which evaluates to FALSE.

Hope this helped to clear things a bit.

Thank you! I misunderstood the question. It say two variable:

a > b

My bad... didn't see that you are on a challange :)

a > b

The challenge says you have to compare variables a and b. By writting "a" > "b" you are comparing two strings and not variables.