Expecting a top level declaration


#1

THE error in this is the red line that was under the print(a === a) and when I hovered the cursor over it, it read “Expected top level declaration”. I copied this from the tutorial online so I am not sure what I doing wrong

package my.demo

import java.util.*

val a: Int = 10000

print(a === a)


#2

I wonder what tutorial is that? Can you please share a link? I’d really suggest going to http://try.kotlinlang.org to learn and try Kotlin. In Kotlin files (.kt) you should write your code in main function as shown in the above Kotlin tutorial in its very first exercise.