We will demonstrate how to write programs in PureBasic by giving you an example. Make sure the PureBasic editor is running, as described in the previous chapter, and type in the following code (or open it from here):
OpenConsole()
PrintN("Hello, world")
Input()
CloseConsole()
End
If you have typed, or copy and pasted, the code from this manual you will need to save
it before you can compile it. Use the "File menu->Save As" item to save the source
code to any location and filename you want. You may want to save the file
with a ".pb" extension as this is associated with the editor.
Once you have saved the file, you can execute it. Use the "Compiler menu->Compile/Run" item or press the "F5" key. If you have any errors in your source code, compare what you have typed with what is on this page and correct the errors. Make sure to save your code again before compiling and running your program again.
| Previous topic | Chapter contents | Next topic |
|---|---|---|
| Fundamentals of the PureBasic language | User Guide contents | Breakdown and explanation of the program |