Ternary Operator

Submitted By:
david

Difficulty:
Elementary

Tags:
operators, ternary operators

Instructions:
The ternary operator is like an if/else in a single line. Use a ternary below to tell if someone's name is Irish.

Code:
a = "Miles O'Brien"
b = "Barack Obama"

assert_equal ((a =~ /[ ]\w'/) ___), "Irish"
assert_equal ((b =~ /[ ]\w'/) ___), "Not Irish"

Your Solution

Ruby 1.9.3

Back to Problems