readLine does not work (returns null)

Hi guys, I’m learning Kotlin and I want to do a calculator. The problem happen when I want to get information for the console with the code “readLine”. In my System.out appear a value “null”. Like in the picture.

This is my code

package com.example.calculadora

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

    var numero = readLine()
    println(numero)

}

}

Your code is that of an android activity. Android has no terminal where you can type things.
If you’re learning just kotlin start without touching android.

2 Likes