Subroutines are blocks of code that can be called from elsewhere in a function. Subroutines take no arguments and return no results, but can access all variables available to the function.
XBasic functions are fully encapsulated and bullet-proof by default. Variables are AUTO (local and temporary) unless declared otherwise, and changes outside a function have no effect within the function except as explicitly specified within the function. Functions arguments can be variables and arrays of any built-in or user-defined data types. Functions can return variables of any data type.
By default, arguments are passed by value. Pass by value is more efficient than pass by reference, especially in RISC systems where many arguments and variables are allocated in registers . XBasic implements argument passing in a novel way that supports passing arguments in any mix of by-value and by-reference each time a function is called! Furthermore, as implemented by XBasic, pass by reference is nearly as fast as pass by value. Pass by address is also supported for C compatibility. XBasic functions can call C functions, and vice versa.
XBasic adds important enhancements to SELECT CASE to provide clean alternatives to previously messy decision structures. Furthermore, the notions of TRUE and FALSE have been extended to strings and arrays. TRUE means has contents, and FALSE means empty. So statements like IF x$ THEN... , IF j THEN... , and LOOP WHILE x$ are more readable and efficient than conventional BASIC alternatives like IF (x$ = "") THEN... .
Computed execution control is supported by variables and arrays of the GOADDR, SUBADDR, and FUNCADDR data types. To GOTO a label, GOSUB a subroutine, or call a function based upon a program condition takes only two or three machine instructions, and avoids the need to traverse huge CASE blocks. Also, destinations can be altered dynamically as programs run. Computed function calls are crucial in event driven programs, and in programs where callback functions are required. Both are necessary in modern GUI based applications.
versatile development environment
XBasic is a versatile program development environment. XBasic has the power, flexibility, and efficiency for virtually every kind of programming, so XBasic programmers enjoy the luxury of working in a single language and development environment to accomplish their diverse programming projects.
XBasic introduces programming for everyone - so simple and user-friendly that it's great for novices, yet powerful enough for the most demanding professional applications. That's why you may never outgrow XBasic, and why XBasic is an ideal program development environment.
XBasic : GraphicsDesigner : GuiDesigner