If you’re new to Kotlin, you might have seen something like this:
val number = 50_000
At first, it might look like a typo. But don’t worry — it’s actually a feature! Kotlin allows underscores in numbers to make large numbers easier to read, just like commas in English numbers.
Think of it this way:
50000 → “fifty thousand”
50_000 → “fifty thousand” (much easier to read)
🔹 Read the full blog on Medium
For a complete beginner-friendly explanation with more examples, check out my Medium article:
https://medium.com/@vrushalidev/why-kotlin-lets-you-write-50-000-instead-of-50000-861f132cc25e
Top comments (0)