This article is part of the Getting Started series |
Numeric variables are variables that contain numbers and can be supposed to arithmetic opperations.
Numeric variable types Edit
- The integer declares variables numeric variables whose value may range between -32768 and 32767. It is the most used type because in programming exercises the variables are usually not bigger than 32767 or smaller than -32768.
- The shortint (short integer) variables can range between -128 and 127.
- The longint (long integer) variables can range between -2147483648 and 2147483647.
- The byte variables can range between 0 and 255. They are called so because they take exactly 1 byte of memory.
- The word variables are less often used and can range between 0 and 65535. Word is usually used when you need an integer that will (or should) never be negative.
Operations with numeric variables Edit
a:=b+c; {addition} a:=b-c; {decrease} a:=b/c; {division with decimals} a:=b div c; {division without decimals} a:=b mod c; {modulo, which is b-(b div c)*c} a:=b*c; {multiplication} a:=sqr(b); {square} a:=sqrt(b); {square root} a:=sin(b); {sinus} a:=cos(b); {cosinus}
Also see operations with variables.