Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
573 views
in Technique[技术] by (71.8m points)

android - Kotlin: Expecting a top level declaration

i'm super new to Kotlin and i don't see my problem anywhere so i guess it's trivial

i was following a tutorial and in it he wrote the following

var nullableName: String? = "Denis"
nullableName = null

and when i typed that in i got a compiler error saying "Expecting a top level declaration" but it didn't for him

i know if i type something like

var nullableName: String? = null

it works fine but i wanna understand why i'm getting that error


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...