Join Slack
Powered by
does anyone know how to declare a variable in kotl...
# android
f
fahadmk
06/08/2017, 4:38 AM
does anyone know how to declare a variable in kotlin globally ?? 😅
l
louiscad
06/08/2017, 6:51 AM
fahadmk: Just declare a
val
in a file at the top level (outside any class). If what you want is a singleton,
object
is for you.
👍 1
r
rook
06/08/2017, 12:54 PM
@fahadmk
do you want a static variable? You’ll want to annotate the variable with
@JvmField
👍 1
Open in Slack
Previous
Next