having trouble implmenting switch function.

closed account (ETA9216C)
I am working on a piece of code on my project where i have to use a switch function.

I want one of the case to say if a students grade is less than or equal to 60 the letter grade is a D. As if i were to do it as a IF statement. I know how to do it as an IF statement.Just not with a switch yet, I've just recently just learned about it.
You do not do that.
closed account (ETA9216C)
so i would have to do it as IF statements then right?

this is what i have:

1
2
3
4
5
6
7
8
    if final_grade<50 return "F";
    if final_grade<60 return "D";
    if final_grade=60 return "C";
    if final_grade<=70 return "C+";
    if final_grade<=80 return "B";
    if final_grade<=85 return "B+";
    if final_grade<=90 return "A";
    if final_grade<=100 return"A+";
Last edited on
Topic archived. No new replies allowed.