# Basic4ppc

Basic4ppc (pronounced "Basic for PPC") is a programming language originally for Pocket PC handheld computers running Windows Mobile operating system, by Anywhere Software. Since 2014, B4x ("B for x") was renamed, and currently, 2023, supports multiple devices and their OS, including desktop and mobile solutions with development adaptions for these environments. The language is based on a BASIC-like syntax, taking advantage of Microsoft's .NET technology, to allow additional libraries, graphical user interface design of windows forms, rapid application development (RAD), and .NET framework compatible compilation. The language implements a unique way of adding objects to a program without being object-oriented. Its advantages are simplicity, development pace and the integration with .NET framework. A special version of the integrated development environment (IDE) allows developing straight onto the Windows Mobile device or. With the demise of Windows Mobile operating system and the devices running it Basic4PPC came to the end of its life in about 2012. For owners of Basic4PPC it remains a useful Windows-desktop BASIC compiler as it runs code directly in the Windows environment and it can compile a project to a Windows 'exe' file for use as a Windows program.

## History (major versions)

* Version 1.00 of Basic4ppc was released in 2005. It was targeted mainly for handheld devices, letting users program in a unique device IDE. Basic concepts were introduced there, such as the direct naming reference and the syntax.
* Version 2.0 added major improvements with user interface, controls and optimization.
* 8/2006 - Version 3.0 released, improved stability, allowed stand-alone compiling for first time.
* 12/2006 - Version 4.0 released, introduced ability to use external libraries for first time.
* 5/2007 - Version 5.0 released, with fully new IDE and support for Smartphones.
* 12/2007 - Version 6.0 created a breakthrough, introduced optimized compiling, thus allowing far better performance on both device and desktop compiled applications.
* 10/2008 - Version 6.5 released, introduced modules support.
* 06/2009 - Version 6.8 released, with automatic support for different screen resolutions and addition of two new collections objects.
* 04/2010 - Version 6.9 released, added support for typed variables and subs.
* 2014 - currently, 2023, supports various OS, including Android, iOS, Windows, Mac, Linux, Arduino, Raspberry PI, ESP8266/ESP32.

## Android

In 2010 a version for Android phones/tablets was released, this is a separate environment working along the same lines and the language is "basic" like and can be compiled to Android devices.

## Language features

Dual development platform: Basic4ppc allows development straight on the handheld device via a fully compatible Device IDE. Code written on either device or desktop IDEs is identical for both platforms and operating systems. Compilation, however, must target either device or desktop, due to the difference in the operating system.
Compilation available in four modes: Windows executable, Device executable for Pocket PC (with and without AutoScale), Desktop executable, and Smartphone executable (for mobile phones running Windows Mobile OS). Compiled .EXE files require .NET 2.0 framework to be installed on the target machine. This is usually the case with Windows XP SP2 and later, but has to be manually taken care of with earlier versions.
Additional libraries: based on the Microsoft .NET framework, Basic4ppc can use code inside .NET .dll files after being adapted for Basic4ppc (this can be done by any programmer using Microsoft Development tools). Many such additional libraries exist, most of which are open source, written by users and accessible via the Basic4ppc forum.
Merging: Additional libraries code is merged into the main executable almost always. This way a single file can be deployed.

## Characteristics

Basic4ppc is procedural, structural, implementing a partial object-oriented programming model. Syntax is similar to common Basic dialects, most influenced by Visual Basic. It supports events. Like most modern languages, the development environment supplies graphical user interface design tools. Users build applications using the drag and drop, component based UI. This is possible on both Device and Desktop, being unique in this ability.
Regular flow structures, such as if…then and for…next are supported, as in many other Basic versions.
Reserved words: Basic4ppc includes a vast number of reserved words. This is because of variable declaration scope.
Variables can be local (accessible throughout a subroutine), global (accessible throughout a module) or public (accessible throughout a program). All variables are typeless. This means you can write the following code:
There is no need to declare variables explicitly.
Subroutines (called "Sub") are the most basic unit of code. All code must be written inside subroutines. Subroutines can return a value.
Direct Naming Reference: All internal controls can be accessed directly and passed as parameters to subroutines by specifying their name expressed as a string. This lets the programmer the ability to pass controls as parameters without knowing in advance the control that is to be passed, and without having to deal with either pointers nor with object oriented programming.
AutoScale mode allows developing for different screen resolution having the language taking care of the adjustments needed in UI appearance.

## Example code

Here is an example of the language:
Code snippet that displays a message box "Hello, World!" as the application starts, without any forms being loaded:

## Libraries

Based on Microsoft's .NET technology, Basic4ppc supports .NET .DLLs with some minor adjustments. This allowed users to create a lot of open-source libraries, downloadable at the Basic4ppc forum, usually with complete source code. As with many other programming languages, additional libraries include most of the real-world language functionality. Additional libraries cover subjects such as graphics, databases, user interface, GPS, barcode readers and peripheral devices, debug, connectivity (bluetooth, wifi, and data-transfer protocols such as http, ftp and so on), XML, and more.