Oct 9, 2012 at 1:09am UTC
Solved.
Last edited on Oct 9, 2012 at 3:33am UTC
Oct 9, 2012 at 1:53am UTC
else if (courseAverage=85-92){letterGrade="B" ;}
What?? That's not how comparisons work.
Its wrong in some many ways, but the jist of it is that it will always evaluate true.
else if (courseAverage>85 && courseAverage<92){letterGrade="B" ;}
Oct 9, 2012 at 2:27am UTC
The logical operator for the idea of "or" is the double pipe symbol:
||
Oct 9, 2012 at 2:49am UTC
you can think of if else statements like:
1 2 3 4
if (this is true then)
{
true goes inside angle braces
}
if the if condition is not true then execute the else
1 2 3 4
else
{
do these things since the if was not true
}
very much like using a
bool
but more complicated and many times you can just use a
bool
instead.
or add
1 2 3 4
else if (other conditions)
{
other conditions can go here
}
for further conditions
Last edited on Oct 9, 2012 at 4:20am UTC