I'm doing that in a program that asks the user whether he wants to continue using the program or wants to quit. So far, I can already make the program close with the user by typing "close", but when I try to type "restart" nothing happens, just skip the line on the console.
How do I actually restart the program, or close and reopen the program quickly, or return it to the user's prompt?
In an example program, make it go back to the proper question of restarting or closing, or in a larger program, make it go back to the first question that requires the user to enter something.
In Small Basic, what would be the best class and method for what I'm talking about?
Here is the current program I have at hand:
TextWindow.WriteLine("Programa para fechar e recomeçar")
TextWindow.WriteLine("")
Sub ReiniciarOuFecharPrograma
inicio:
If resposta = "reiniciar" Then
Goto inicio
ElseIf resposta = "fechar" Then
Program.End()
EndIf
EndSub
inicio = Program.GetArgument(20)
TextWindow.WriteLine("Escreva 'fechar' para sair.")
TextWindow.WriteLine("Escreva 'reiniciar' para recomeçar o programa.")
TextWindow.WriteLine("")
TextWindow.WriteLine("Você quer fechar/reiniciar?")
TextWindow.WriteLine("")
resposta = TextWindow.Read()
ReiniciarOuFecharPrograma()
The class and method Program.GetArgument()
would not be correct with what I want to do, right? They are interacting with the line 20% with%.