PureBasic, short for PureBasic Programming Language, is a procedural programming language created by Fantaisie Software in 1998. PureBasic focuses on simplicity, performance, and portability, allowing developers to create desktop applications, utilities, and games across Windows, macOS, and Linux. Official downloads, compilers, and documentation are available at the PureBasic Official Site, and the language provides an IDE for writing, compiling, and debugging applications.
PureBasic exists to provide a language that is easy to learn yet powerful enough for real-world software development. Its design philosophy emphasizes minimal syntax, direct memory access, and native code compilation for high performance, while maintaining readability and portability across multiple operating systems.
PureBasic: Variables and Functions
Variables in PureBasic are declared with explicit types such as Byte, Integer, or String. Functions are defined using the Procedure keyword.
' declare variables
Define name.s = "Alice"
Define age.i = 30
' define a function
Procedure Greet(person.s)
Print "Hello, " + person
EndProcedure
Greet(name)This ensures type safety and clarity while allowing flexible function definitions. Procedures can accept parameters and return values to structure program logic effectively.
PureBasic: Control Flow
Conditional and loop statements include If, ElseIf, Else, For, While, Repeat, and Select.
If age >= 18
Print "Adult"
Else
Print "Minor"
EndIf
For i = 1 To 5
Print i
Next iThese constructs allow clear program flow, making it easy to read and maintain PureBasic code while supporting structured programming paradigms.
PureBasic: Arrays and Strings
PureBasic supports fixed-size arrays, dynamic arrays, and string manipulation functions.
' fixed-size array
Define numbers.i[5] = {1,2,3,4,5}
' dynamic string list
Define names.s(0)
AddElement(names())
names(0) = "Alice"
AddElement(names())
names(1) = "Bob"
For i = 0 To ArraySize(numbers()) - 1
Print numbers(i)
Next iArrays and string lists allow storage and manipulation of structured data, useful in applications from game development to utilities.
PureBasic: Libraries and Modules
PureBasic provides built-in libraries for graphics, networking, sound, and system access.
' graphics library example
OpenWindow(0, 100, 100, 400, 300, "PureBasic Example")
StartDrawing(WindowOutput(0))
Box(50, 50, 100, 100)
StopDrawing()
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindowThese libraries simplify development of GUI and multimedia applications, while modules and built-in functions encourage organized and reusable code.
PureBasic is used for desktop application development, game creation, and utilities across multiple platforms. Its focus on simplicity, high performance, and cross-platform support makes it a practical choice alongside BlitzMax, FreeBASIC, and Monkey X.