This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Conditionals and Control Flow Forum

View Course » View Exercise

39 points
48b8015443fc6e893a6cba7532a25ca2?s=140&d=retro
Submitted by
Akshay Sharma
over 1 year ago

Why wont this code is not working?

<?php
$items = 3;

    if($items > 5) {
      echo "You get a 10% discount!";
    }
    else {
     echo "you got 5% discount!";   
    }
  ?>
</p>

0 votes

permalink

In what would be considered line 2 or $items = 3; should be $items == 3;. Double equal signs, ==, is the equal to operator.

121 points
Ca4095d8df31ed4566cba15e7f603ffc?s=140&d=retro
Submitted by
Dominic N.
over 1 year ago


0 votes

permalink

Uppercases are important here!
My Code:

 else {
     echo "You get a 5% discount!";
 }

Your Code:

 else {
     echo "you got 5% discount!";   
    }

The You is the Mistake

BR
D.

1409 points
588b2ac3e1281365f0000133_918398059
Submitted by
Codmakr
over 1 year ago