Conditional and control flow(1.Glance at the pas)t


#1







<?php
$item = 3;
if( $Item > 5){
print"The item is true";
}
else{
print"The item is false";
}
?>


Somebody should help me please,the reply was Oops, try again. Are you sure you made an else if condition? and the output was,Undefined variable: Item (line 9)The item is false.


#2

if( $Item > 5)

should be $item not $Item


#3

<?php
$item = 3;
if( $item > 5){
print"The item is true";
}
else{
print"The item is false";
}
?>
And after the correction,the reply was"Oops, try again. Are you sure you made an else if condition"


#4

i think you are told to do so. can you please post the lesson link here ?


#5

https://www.codecademy.com/courses/web-beginner-en-jZv2E/0/1?curriculum_id=5124ef4c78d510dd89003eb8


#6

instruction:
Write an if/elseif/else statement inside the editor and make it output anything you.

so you need else if in your code. now you just have if and else

syntax:

       if(condition){
          
         //Do somthing
        }
        else if(condition)
        {
            //Do somthing else
        }
        else{
           // Do somthing else
        }

try yourself :slight_smile:


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.