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

Conditionals and Control Flow Forum

View Course » View Exercise

471 points
5374b15652f8635a29001b79_426813904
Submitted by
Daniel Ghinn
over 4 years ago

Err msg :Oops, try again! Did you remember to include the else keyword?

Also in the result box it says :Parse error: syntax error, unexpected T_ELSE on line 11
heres my code:
<?php
$items = 9 ;
if ($items > 5) {
echo "You get a 10% discount!";
else ($items < 5) {
echo "You get a 5% discount!";
}}

  ?>

2 votes

permalink

<?php
$items = 10;

// Set this to a number greater than 5!
if($items==1){
echo "Sorry, no discount!";
}elseif($items >= 5){
echo "You get a 10% discount!";
} else{
echo "You get a 5% discount!";
}

  ?>

1411 points
514b89c33fc6c04a6c000253_298152979
Submitted by
Rosendo
over 4 years ago


0 votes

permalink

I had posted just below your question I think thats how I went about just look at the post below you

630 points
436bd015e5aec2ef07d87ad445661f9a?s=140&d=retro
Submitted by
maxwell ochieng ojwang
over 4 years ago