1. is this actually a good way to write code? `.t...
# announcements
m
2. is this actually a good way to write code?
.takeIf {}?.let {} ?: else
đŸ€ą 4
đŸ§” 4
no red 2
👌 1
a
The “common way” was clear and readable, I’m not sure why you think it wasn’t the Kotlin way.
➕ 1
m
i answered in the general channel
đŸ§” 3
k
This pattern is discouraged.
an other way of doing it is
Copy code
n?: throw Exception
n = null
or maybe more liked be most people
Copy code
if(n != null)
    throw Exception
n = null
a
or even
Copy code
check(n != null) { "reason...." }
n = null
especially if this is the full body of a method
m
hmm, i'll take a look at require, thank you
m
please @mplain for the future when you ask a question expect answers and add your comments under its thread to avoid polluting the main channel, thanks
m
okay, will do
first time on Slack
m
don’t worry, just follow what the other users of this slack space do 😉