does anyone know how to declare a variable in kotl...
# android
f
does anyone know how to declare a variable in kotlin globally ?? 😅
l
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
@fahadmk do you want a static variable? You’ll want to annotate the variable with
@JvmField
👍 1