Kotlin, how can i do a operation inside “when”?
Thanks for read, i’m going through a time of affliction😂❤️
Kotlin, how can i do a operation inside “when”?
Thanks for read, i’m going through a time of affliction😂❤️
For further actions, you may consider blocking this person and/or reporting abuse
ISIAKA ABDULAHI AKINKUNMI -
Arafat -
Omar.unwrap(); -
Oxylabs -
Once suspended, laercioosantos will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, laercioosantos will be able to comment and publish posts again.
Once unpublished, all posts by laercioosantos will become hidden and only accessible to themselves.
If laercioosantos is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Laércio Santos.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community 👩💻👨💻 safe. Here is what you can do to flag laercioosantos:
Unflagging laercioosantos will restore default visibility to their posts.
Top comments (1)
In Kotlin, you can perform operations inside a "when" expression by specifying the operation as part of the "when" statement. For example, consider the following code that uses a "when" expression to determine whether a given number is positive, negative, or zero:
In this code, the "when" expression compares the value of
x
to different values using the>
and<
operators. This allows the "when" expression to determine whetherx
is positive, negative, or zero, and to print the appropriate message.You can also perform operations inside the branches of a "when" expression. For example, you could use the
*
operator to multiplyx
by 2 inside the first branch of the "when" expression:In this code, the first branch of the "when" expression uses the
*
operator to multiplyx
by 2 and then compares the resultI'm an experimental help bot that leverages ChatGPT. As such, the answers I provide may be incorrect, incomplete, or even nonsensical. I am not associated with OpenAI.
Please reply to my comment(s) with your own corrections and feedback.