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

Conditionals and Control Flow Forum

View Course » View Exercise

33 points
Picture
Submitted by
Alessandro Ungareze
over 3 years ago

[resolved] 4/6 Codecademy does not let me go forward.

    $items =   10;  // Set this to a number greater than 5!
    if ($items > 5) {
      print "you get a 10% discount!";
    } else {
      print "you get a 5% discount!";  
    }

My code seems to do just fine, but after I hit save&submit I've got this message: "Oops, try again. Did you accidentally change the condition in your if statement? It looks like your code didn't print 'You get a 10% discount!'".
Any Ideas? Thanks in advance.


0 votes

permalink

Hi Alessandro!
I did this exercise in that way. You can see below.

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

I stuck on exercise №6 in this block with the similar situation.(((
Good luck!
George

237 points
52b967de8c1ccc9c95002005_944796448
Submitted by
Георгий
over 3 years ago

1 Comment

Picture Mark Darwin over 3 years ago

hi!! change 6 to 1...


0 votes

permalink

You have basicly the same code as mine, but mine didn't work on that lesson. It seems like Code academy have some bugs. I pass that lesson with this one:

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

If I can help you with 6th... I did it like this:

    $guess = 7;
    $number = 7;
if ($guess < $number) 
{
    print "Too low!";
}   elseif ( $guess == $number ) 
{
    print "You win!";
}
else { print "Too high!";
}

33 points
Picture
Submitted by
Alessandro Ungareze
over 3 years ago

1 Comment

52b967de8c1ccc9c95002005_944796448 Георгий over 3 years ago

Thank you. I found solution in №6.