i'm to learning programing in kotlin and i practicing with the control flow (wile), the problem is that i want to appear ten number in my virtual device and just appear one.
This is the my code:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
button.setOnClickListener {
var num = ingrese_valor.text.toString().toInt()
while (num < 10) {
num++
tv_resultad.text = ("" + num)
}
}
}
}
Exanple : enter image description here