Course of Raku / Essentials / Conditional checks

Comparing strings

String comparison uses its own set of operators:

eq Equal
ne Not equal
gt Greater than
ge Greater than or equal
lt Less than
le Less than or equal

Examples

Examine a few examples of comparing two strings:

say 'alpha' lt 'beta'; # True
say 'word' ne 'Word';  # True
say 'xyz' gt 'xvw';    # True

Practice

Complete the quizzes that cover the contents of this topic.

Course navigation

Conditional checks / Comparing numbers   |   Conditional checks / Ternary operator


💪 Or jump directly to the exercises to this section.