MLHA - PC - Programmering - Basic - QBASIC

Reserved words: >Keywords >Statements >Functions

>Keyboard

>Rutiner >Programmer

| Operators | Data Types | Variables | Metacommands |

http://www.qbasic.com/
http://qbasicnews.com/ : Qbasic News
http://qbcm.hybd.net/index.shtml : QB Cult Magazine
http://www.geocities.com/Area51/5967/qbasic.html : Qbasic Download Page
http://members.tripod.com/~connorr/qb.htm : Connor's House: Qbasic Links
http://www.enteract.com/~dandd/basic/ : Qbasic Tutorial
http://qbplace.hypermart.net/home.html : The Qbasic Place
http://members.tripod.com/~connorr/guide/index.htm
http://www.jake.dk/programmering/qbasic/dk/index.html
http://www.clg-net.com/basic/ : Qbasic Lessons
http://doorknobsoft.tripod.com/qbasic_tutorial.html
http://www.ddj.com/articles/2001/0185/languages/qbasic_tutorial.htm
http://www.hitmill.com/programming/qbasic.html

 

QBASIC - Operators
| Boolean |

+   PRINT 5 + 2
PRINT "Q" + "Basic"
7
"QBasic"
- PRINT 5 - 2 3
* PRINT 5 * 2 10
/ PRINT 5 / 2 2.5
^ PRINT 5 ^ 2 25
\ PRINT 5 \ 2 2
MOD PRINT 5 MOD 2 1

   
Boolean operators

 

AND  
EQU
IMP
NOT
OR
XOR

 

QBASIC - Data types

suffix   Type   Bytes   Range
% Integer 2 -32,768 .. 32,767
& Long 4 -2,147,483,648 .. 2,147,483,647
(default)! Single 4 ±3.4E±38 (3.4 * 10 ^ 38)
# Double 8 ±1.8E±308
$ String 0..16384 variable length string
String * n 0..16384 fixed length string

 

QBASIC - Variables

Variabel-værdiernes placering i hukommelsen kan findes med funktionerne
- VARSEG(var) - variablens segment
- VARPTR(var) - variablens offset
- SADD(string) - string offset

 

QBASIC - Metacommands

$DYNAMIC
Specifies that arrays declared in subsequent DIM statements are dynamic arrays.
Array storage is allocated dynamically while the program runs.
REM $DYNAMIC
' $DYNAMIC
$STATIC
Specifies that arrays declared in subsequent DIM statements are static arrays (unless they are declared in a non-static SUB or FUNCTION procedure).
Array storage is allocated when you start the program, and remains fixed.
REM $STATIC
' $STATIC
 
NB: DIM and REDIM usually provide a better way to specify whether arrays are dynamic or static.

 

Operators

AND    Conjunction
EQV Equivalence
IMP Implication
MOD Modulus
NOT Bit-wise complement
OR Disjunction (inclusive "or")
XOR Exclusive "or

Mathematical Operators

*  Multiplication symbol
-  Minus sign
/  Division symbol (slash)
=  Relational operator or assignment symbol
>  Greater than
+  Plus sign
.  Decimal point
<  Less than
\  Integer division symbol (backslash)
^  Exponentiation symbol (up arrow or caret) 

 

Data type suffix

%  Integer
&  Long-integer
!  Single-precision
#  Double-precision
$  String