Case-statements-quiz

Case Statements Quiz

Objectives

  1. Distinguish a case statement from other patterns

  2. Identify when to use a case statement

  3. Write a case statement

Note: If you see concepts in the quiz that you might not have seen before, then Google it. Knowing how to look for information is an important part of being a good programmer so we're not going to always give you everything you need to figure out a problem; some of it will be on you.

???

Quiz

?: Which of the following is a case statement?

( )

name = "Steven"

if name == "Steven"
  "Hi, #{name}"
else
  puts "Hi, stranger!"

(X)

( )

?: Of the following two examples, which example uses the case statement the best?

( )

( )

(X) Both are good as case statements

?: Which operator does a case statement use to compare the value to the conditions?

(X) === ( ) == ( ) =

???

View Case Statements Quiz on Learn.co and start learning to code for free.

Last updated