PHP - Control Flow: Switch - Glance at the Past -- reviews elseif, but it hasn't been introduced yet

This Glance at the past is asking to refresh what we have done in the previous course and “Write an if/elseif/else statement inside the editor and make it output anything you wish.”, however, the if/elseif/else statement was not covered in the previous course. The said course ended with an if/else statement.

Technically, there is only if and else so not much new when introducing them in combination. It permits a multiway conditional branch permitting more than one condition to be tested in the same statement.

if ($a) {

} elseif ($b) {

} else {

}

I know JavaScript so I knew what it was asking for but when learning a new language this should not be assumed. For this reason alone I would expect Codecademy would want to correct the course.

Makes sense, yes. Can you please post a link to the lesson so I can give it a further read and examination. If I end up agreeing with you (I don’t actually disagree) then we can reassign this thread. Thank you.

Or not. Guess the interest is now lost?

https://www.codecademy.com/courses/web-beginner-en-jZv2E/0/1

I Reset this lesson, https://www.codecademy.com/en/courses/web-beginner-en-QF3Wb/0/4
and got this, as a starting point…

<html>
  <head>
  </head>
  <body>
    <p>
      <?php
        // Write your if/elseif/else statement here!
        
      ?>
    </p>
  </body>
</html>
<html>

Looking over the instructions, there is no call for elseif yet above it clearly asks for it. The passing code only needs to follow the instructions, explicitly…

<p>
      <?php
        // Write your if/elseif/else statement here!
        if ('gray' == 'white'){
            echo "The condition is true";
        } else {
            echo "The condition is false";
        }
      ?>
      
    </p>

So despite the instruction in the comment, the lesson does not give us practice with elseif so the point made by the OP is valid. Reassigning this topic.

Confused. Why ask me for a link and then provide it yourself? Regardless, I believe it is shown at the top of this thread?

No, the interest is not lost. I submitted this issue because the course should be corrected if not for myself for someone new to programming. It is misleading.

I got impatient with the delay, and took it to mean you had moved on. Pardon me.

I was not monitoring the Q/A Forum as I am still completing the course.

1 Like

It is May 31, 2016 & the ELSEIF issue has not been addressed in this course.

“And the times, they are a changing” (Bob Dylan)

But not this course.