

Forīackwards compatibility, we also allow variable names to have a dollar signĪppended to them. Try for examle: 10 PRINT COLOR(5, 3)ģ0 PRINT COLOR(5, 3) Variables All variables are a single letter optionally followed by digits. This is a string that is initially "gray". See for example the pong game (Projects->Games->Pong).ĬOLOR( x, y) - returns the color of the pixel at position x, y. Try this for example: 100 LET C = GETCHAR() Quite BASIC has a queue for key strokes, and GETCHAR picks them up in order until the queue is empty. LOWERCASE( string) - returns 'string' converted lowercase. UPPERCASE( string) - returns 'string' converted uppercase. LEN( string) - Returns the length of a string. For example, try this program: 100 LET A = "ABC123" MID( string, start, n) - returns 'n' characters starting at character 'start' (the first character is index zero). RIGHT( string, n) - returns the 'n' last characters for 'string'. LEFT( string, n) - returns the 'n' first characters for 'string'. Quite BASIC variables are not typed so this has no meaning. For backwardsĬompatibility, functions may have a dollar sign appended (like so: MID$), but "LEFT", "RIGHT" and "MID" are all supported as well as "LEN". This wouldn't be classic BASIC without those string functions, but fear not, It generates a random number between zero and X (the argument).

In addition there are two functions for rounding and flooring a real number into an integer.Īnd there is a random number generating function. They are used by simply writing the name of the function followed by the numeric argument enclosed by parentheses.

The common mathematical functions that you see on a standard calculator are supported. In that case you would use it in the program's main loop similarly to this: 100 PAUSE (6 - LEVEL) * 100 Functions You can use it to control the speed of a game for example.

It is a read-only integer between 1 and 5 that is controlled by the user. The parameter LEVEL is not strictly a constant.
Printing from purebasic plus#
The plus sign can be used for numbers and for concatenating strings. Operators in expressions are the usual: +, -, /, and *.
Printing from purebasic how to#
Here are examples of how to print a few expressions: 100 PRINT 5 + 3 100 PRINT "Hello" + " " + "world!" 100 PRINT 5 % 3 100 PRINT SIN(3 * PI)Īnd here's an expression in an assignment: 100 LET X = 5 + 3Īnd in a conditional: 100 IF A = B THEN GOTO 500 Testing for equality and assignment are both written with a single equal sign, =. Not equal is written and applies to numbers as well as strings. To get that classic look you can use all upper case for commands like: 100 PRINT "Hello world!"īut the commands are actually not case sensitive, so you could just as well write: 100 print "Hello world!"Įxpressions in classic BASIC are similar to modern programming languages, but there are a few notable differences. Quite BASIC is classic BASIC, with line numbers and all. You'll see examples all BASIC commands and many of the Look at the preloaded sample BASIC program and the projects in the "Projects" If you are the type that learns from examples, take a Just type your BASIC program in the 'Basic Program' text field and then I'm trying to get an error state out of my Custom vkp80III ticket printer using windows' winspool library and this example Īpp has this print call.If you ever programmed classic BASIC it should be easy to get started.
Printing from purebasic windows#
I'm creating a Qt WebEngine application for Windows that display a webpage and uses printer to print out whatever is displayed.
