I want to know how I display integers on godot

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Scoob doo

Hello everyone, everything good ?
I have a question here. I want the program to display all integer values ​​up to the number entered by the user.
example:
user puts 4
appears on the screen
values: 0.1,2,3,4

my code everytime the error. help me please

:bust_in_silhouette: Reply From: PhantomPixel

One way to do it is to have a line edit node that connects to your script using the text_changed() signal(text_entered also works, but the user has to hit the return button for the text to update). Then, just set your label to that new text

Ex:

  func _on_LineEdit_text_changed(new_text):
    	$Label.text = new_text
:bust_in_silhouette: Reply From: DaddyMonster

Here you go:

func _ready():
	count_to(4)

func count_to(num):
	for n in num+1:
		print(n)