https://kotlinlang.org logo
#mathematics
Title
# mathematics
b

breandan

01/05/2019, 7:14 PM
What characters valid Kotlin identifiers? Some unicode characters are allowed without backtick-escaping. For example
val ε = 0.03
is a valid statement, but
val ∇ = 0.03
is not.
Apparently it allows symbols from Unicode character categories
Lu
,
Ll
,
Lt
,
Lm
,
Lo
,
Nl
and
Nd
. The lexical grammar is defined here: https://github.com/JetBrains/kotlin-spec/blob/master/kotlin-spec.asc#42-lexical-grammar
g

gildor

01/06/2019, 7:45 PM
You also can use backtickes:
Copy code
val `∇` = 0.03
b

breandan

01/07/2019, 6:33 AM
Yeah, but are also some restrictions on characters you can put inside backticks
5 Views