operators, ternary operators
The ternary operator is like an if/else in a single line. Use a ternary below to tell if someone's name is Irish.
a = "Miles O'Brien" b = "Barack Obama" assert_equal ((a =~ /[ ]\w'/) ___), "Irish" assert_equal ((b =~ /[ ]\w'/) ___), "Not Irish"
Back to Problems