Kotlin

- Files
.kt.kts- Formats as
- Ur
- Lints
- Every rule that reads its code
- In
ur.toml [format.kotlin]
Formatted
Cart.kt, as written// What a cart costs.
data class Item(val name:String,val price:Int,val quantity:Int)
fun subtotal(items:List<Item>):Int{return items.sumOf{it.price*it.quantity}}
fun label(item:Item)=item.name+" x"+item.quantity
ur format --style ur Cart.kt// What a cart costs.
data class Item(val name:String, val price:Int, val quantity:Int)
fun subtotal(items:List<Item>):Int{return items.sumOf{it.price*it.quantity}}
fun label(item:Item)=item.name+" x"+item.quantity
Versions
Ur reads Kotlin as the profiles below name it. Name the versions a project targets in target; without it, Ur reads kotlin-2.4.
| Profile | Dialect |
|---|---|
kotlin-1.9 | Kotlinc |
kotlin-2.0 | Kotlinc |
kotlin-2.1 | Kotlinc |
kotlin-2.2 | Kotlinc |
kotlin-2.3 | Kotlinc |
kotlin-2.4 | Kotlinc |