conditional expressions

how would i write this in an conditional expression?

1
2
3
4
 .if (temp > 45)
population = base * 10;
else
population = base * 2;
Last edited on
population = (temp > 45) ? (base * 10) : (base * 2);
Last edited on
thank you :)
Topic archived. No new replies allowed.