educative.io

Why can't I use a basic print("hello") in code window

I have tried to use the print statement in the code window and I get an error stating it is looking for a top level…

Why can’t I use the basic print statement to print out my vars etc in the code window?

Type your question above this line.

Course: https://www.educative.io/collection/6235480473468928/5555126448160768
Lesson: https://www.educative.io/collection/page/6235480473468928/5555126448160768/5065613791723520

Hi @David_King ,
You can create the main function to print something in Kotlin. I am attaching a screenshot of the sample code that I have written to print the variable’s value in the code widget. You can declare more variables within the main function to print their values.