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

Conditionals and Control Flow Forum

View Course » View Exercise

274 points
3b32a757d0bfdd1fc375158bf8fa08db?s=140&d=retro
Submitted by
coldmud
almost 4 years ago

Won't let me pass!!!

Couldn't find anything wrong with my code but it won't let me pass!
The error message was "Oops, try again! It looks like you didn't print anything!"
I did try both "echo" and "print"!

<?php
$items = 7; // Set this to a number greater than 5!
if ($items > 5) {
echo "You get a 10% discount!";
} else {
echo "You get a 5% discount!";
}
?>


1 vote

permalink

Sliced BoB it doesn't work for me eaither...

96 points
87c2cb8cac03699a8ef2c411dfa21fe6?s=140&d=retro
Submitted by
Joga2013
almost 4 years ago

1 Comment

A8c2b73548849898962a6a30f3e16ce5?s=140&d=retro Sliced BoB almost 4 years ago

If... or Else!



<?php //ADD YOUR CODE HERE.
?>


0 votes

permalink

I'm having the same problem. My code is here:

<?php
$items = 4;
if ($items > 5) {
print "You get a 10% discount!";
} else ($items >= 5) {
print "You get a 5% discount!";
}
?>

46 points
881e83ef34f77c31115c39e724bb4b2e?s=140&d=retro
Submitted by
adunx
almost 4 years ago

4 Comments

3b32a757d0bfdd1fc375158bf8fa08db?s=140&d=retro coldmud almost 4 years ago

Oh, You don't need any condition next to "else." Just do " } else { " and then "print"

51dd0b6c52f8634a70001c38_139632258 SkyDevel almost 4 years ago

the guy that wrote this tutorial screwed up.

881e83ef34f77c31115c39e724bb4b2e?s=140&d=retro adunx almost 4 years ago

thanks!

A8c2b73548849898962a6a30f3e16ce5?s=140&d=retro Sliced BoB almost 4 years ago

If... or Else! <?php //ADD YOUR CODE HERE. ?>


0 votes

permalink

What's wrong in this??

<?php
$count = 3;
if ($count > 5){
print "You get a huge discount";
}
else{
print "You get a 5% discount!";
}
?>

59 points
Fac3efe702a7b337361f447aa2ff52d0?s=140&d=retro
Submitted by
Kishan Kumar
almost 4 years ago

1 Comment

A8c2b73548849898962a6a30f3e16ce5?s=140&d=retro Sliced BoB almost 4 years ago

Make sure you set your number to get the huge discount. If... or Else! <?php //ADD YOUR CODE HERE. ?>


0 votes

permalink

This tutorial is screwed!

<?php
$items = 3;
if ($items > 5) {
    print("You get a 20% discount!");
} else {
    print("You get a 5% discount!");
}
?>

Oops, try again! It looks like you didn't print anything!

112 points
7bfe4b3bbcf2e2b6b09680eba3d17120?s=140&d=retro
Submitted by
Abi Narayan
almost 4 years ago

1 Comment

A8c2b73548849898962a6a30f3e16ce5?s=140&d=retro Sliced BoB almost 4 years ago

Make sure you set your number to get the huge discount. If... or Else! <?php //ADD YOUR CODE HERE. ?>


0 votes

permalink

Yeah I came here to PHP to make some progress because of a similar bug in the python tutorial, I give up on CodeAcademy. I found a similar bug in the CSS lesson. I can't waste any more time on this, trying different browsers and having it tell me I didn't print anything when the exact phrase they call for is printed. Worse is the contradictory statement about whether five items gets a discount. Nice try codeacademy but if this is what you got you are losing customers.

297 points
51d7040a8c1ccc22a601c40f_321998063
Submitted by
Lohse James
almost 4 years ago

4 Comments

61a31de62433f8f28e461f00e514d6c0?s=140&d=retro albionsaint almost 4 years ago

You are not a customer in any way, this is all being provided free of charge, If you don't like it then go elsewhere.

51d7040a8c1ccc22a601c40f_321998063 Lohse James almost 4 years ago

Thanks I have. You may want to take a second look at codeacademy's business model before you assume we are not "customers." Thanks

51d7040a8c1ccc22a601c40f_321998063 Lohse James almost 4 years ago

These guys from the "About" page certainly care about our feedback lol:

"Our Investors

We're backed by some great people, including: Union Square Ventures, Index Ventures, Kleiner Perkins, O'Reilly, SV Angel, Thrive Capital, CrunchFund, Collaborative Fund, Founder Collective, Yuri Milner, Vivi Nevo, Richard Branson, and several others."

Yeah I am sure they are in it just for good feelings and giving away a free service, not for collecting personal info for marketing purposes -- right!

61a31de62433f8f28e461f00e514d6c0?s=140&d=retro albionsaint almost 4 years ago

A quick google of the word "customer" should help you out here buddy, clearly you do not understand or even know the meaning of the word.


0 votes

permalink

I passed with the following. It took a couple of tries and a lot of error messages. I copied the example, changed the required text, and added all the code from lesson 01.

If... or Else!



<?php
$items = 9;
if ($items >= 5) {
print "You get a 10% discount!";
} else {
print "You get a 5% discount!";
}
// prints "Who are you?"
?>

445 points
A8c2b73548849898962a6a30f3e16ce5?s=140&d=retro
Submitted by
Sliced BoB
almost 4 years ago

2 Comments

51d7040a8c1ccc22a601c40f_321998063 Lohse James almost 4 years ago

SlicedBob I put in the exact same thing on my work Mac and got an error. Thanks for posting, but this does not work for me. Who can say what's wrong, it's hard to believe something in the environment is causing this when their code should be running on their server. Thanks though.

A8c2b73548849898962a6a30f3e16ce5?s=140&d=retro Sliced BoB almost 4 years ago

Goto lesson 01 in the same section. Copy all the code. Paste the code under the code you wrote, and replace the "<?php" block with the one you wrote or mine. Make sure $items is 5 or bigger.


-1 votes

permalink

I'd suggest skipping this chapter until a fix is made.

511 points
9a7db1a3164d6dc33a591e034410739e?s=140&d=retro
Submitted by
sauravshrestha
almost 4 years ago