Great read. I particularly don't use switch too often unless I use more than 3 or 4 ifs to make code cleaner. To make switch statements even cleaner combine them with enums if your language supports them.
Switch in kotlin are nice:
when {
x.isOdd() -> print("x is odd")
x.isEven() -> print("x is even")
else -> print("x is funny")
}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great read. I particularly don't use switch too often unless I use more than 3 or 4 ifs to make code cleaner. To make switch statements even cleaner combine them with enums if your language supports them.
Switch in kotlin are nice: