kotlin-by-example icon indicating copy to clipboard operation
kotlin-by-example copied to clipboard

The sources of Kotlin by Example.

Results 28 kotlin-by-example issues
Sort by recently updated
recently updated
newest added

Null Safety In an effort to rid the world of NullPointerException, variable types in Kotlin don't allow the assignment of null. If you need a variable that can be null,...

it was returning only error, not the exact output for the nullable variable.

The example for "let" has "customPrint" which is never defined nor mentioned; only used. This is confusing for readers.

As a beginner to Kotlin, I don't know what the abs(it) means, the sample code shows the missing import statement and it confuses the reader with error: unresolved reference: abs...

fixed the sort logic, as abs(it) would fail if the array was listOf(5, 4, 2, 1, 3, -2, -10) . with abs(it), output would be: [-10, 5, 4, 3, 2,...

We don't want to hide the function from the documentation as it confuses the reader

Fix a typo - use 'of' instead of 'on'

Replace Java forEach with Kotlin forEach