If/else is for branching the flow of execution, not for evaluation. In other words, you use if/else to decide what statements to execute, not what value to return.
Here’s how to do it with if/else:
if (temp > 60) {
rates = 500;
} else {
rates = 150;
}
There’s also an operator called the “conditional operator” or “ternary operator” that works more the way you where thinking — if an expression evaluates true, it returns the first specified value, and if not, it returns the second. It’s written using a question mark and a colon, and here’s how it would work in this case:
rates = (temp > 60) ? 500 : 150;
If/else can do a lot more than this single evaluation, but it’s as compact. The conditional operator is much more limited, but quite compact.