How to create a console application

To create console based application you just have to use Console module and its commands. The minimal program could look like the following:

Uses "Console"

Console_WriteLine("Hello, I am console, who are you?")

Dim Name As String = Console_ReadLine()

Console_WriteLine("Hello " + Name)

Console_WaitKey
The first line tells ThinBASIC which module we want to use, and prepares all the keywords in the module to be ready to used.

The second line simply writes line of text on the screen.

The third line places user input from the console to variable Name.

The fourth line composes simple message and again writes it to screen.

The last line says that the program will wait for user key press. As there is no other code after that line, after pressing the key the program will end.

While it is not necessary, for code clarity it is recommended to put all your main program code to function TBMAIN. This function takes some special treatement, as it is first function executed by ThinBASIC. The modified code would look like:

Uses "Console"

Function TBMain() As Long
  Console_WriteLine("Hello, I am console, who are you?")
  
  Local Name As String = Console_ReadLine()
  
  Console_WriteLine("Hello " + Name)
  
  Console_WaitKey
End Function
While for such a simple code encapsulation to function does not add any functionality, it is good practice which will make clear where program begins, after you add other, user defined functions.