Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNdong Landry
1,703 PointsFor some reason, the codes I have written seem not to work, am sure i'm missing something please kindly help.
I'm trying to compare two results to a gpa of 4 and echo out a result if the values of variables are equal to 4, I've tried several way with if, if else conditionals yet my answers aren't correct, please give me a heads up on how to proceed. Thank you
<?php
$studentOneName = 'Dave';
$studentOneGPA = 3.8;
$studentTwoName = 'Treasure';
$studentTwoGPA = 4.0;
if ($studentOneGPA ==4.0){
echo $studentOneName." "."made the Honor Roll";
}
else{
echo $studentOneName." "."has a GPA OF".$studentOneGPA;
}
if ($studentTwoGPA ==4.0){
echo $studentTwoName." "."made the Honor Roll";
}
else{
echo $studentTwoName." "."has a GPA OF".$studentTwoGPA;
}
//Place your code below this comment
?>
1 Answer
Zachary Billingsley
6,187 PointsHello!
The challenges are very case sensitive.
In your else statements the "OF" is capitalized where they shouldn't be and there should be a space between that "of" and the $studentGpa variables.
Hope that helps!