Skip to content

Kotlin style guide discussion #584

Description

@tomholub

Here I will leave comments about Kotlin style patterns I notice, and my proposals on which ones seem most readable. Later we will discuss and compromise on something we can both live with :)

So far I noticed:

  1. I prefer to avoid Multiline ternary operators:
// Weirdreturnif (condition) {
"XXX"
} else {
"Yyy"
}
// Goodreturnif (condition) "XXX"else"Yyy"
  1. empty whenelse should be on one line
when (cond) {
"X"-> functionality ()
else-> {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions