## Conditionals and Control Flow Forum View Course » View Exercise

<html>
<title>Our Shop</title>
<body>
<p>
<?php
\$items =  3;   // Set this to a number greater than 5!
if(\$items <= 5){
echo "You get a 10% discount!";
}
else{
print "You get a 5% discount!";
}
?>
</p>
</body>
</html>

click reset code then do the job

This worked Thankfully. But the instructions were:

Under your if statement, write an else statement to capture the people who are only buying 5 items or fewer. In their case, print or echo "You get a 5% discount!"

Your code gives to output, "You get a 10% discount!"

Anyway, thanks to you I can move on now.

"You get a 10% discount!" is the output that is meant to come out. The "You get a 5% discount" is just for people who are only buying 5 items or fewer. In this case, the task asked you to set \$items to a number that is greater than 5, so you will end up getting the output "You get a 10% discount!"

M Em about 4 years ago

Our Shop

<?php
\$items = 75; // Set this to a number greater than 5!
if(\$items <= 5){
echo "You get a 10% discount!";
}
else{
print "You get a 5% discount!";
}
echo "The condition is false";
?>

Hey, I've found two errors in your code.

First off, your 8th line of code:
\$items = 3; // Set this to a number greater than 5!
has an error. It states that you have to set this to a number greater than 5; 3 won't be acceptable. Change this to 6.

Your second error is in the 9th line of the code.
if(\$items <= 5){
The code should state if (\$items > 5) {
because the number has to be greater than 5 in order to get the 10% discount, not less than or equal to.
Good try, though - this one gave me a bit of trouble, too :)

##### 1 Comment

Sercan Altundaş about 4 years ago

its right, it works