Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
PUNCTUATORS
The mikroBasic PRO punctuators (also known as separators) are:
- [ ] – Brackets 
- ( ) – Parentheses 
- , – Comma 
- : – Colon 
- . – Dot 
Brackets
Brackets 
[ ]
indicate single and multidimensional array subscripts:
dim alphabet as byte[30]
' ...
alphabet[2] = "c"
For more information, refer to Arrays.
Parentheses
Parentheses 
( )
are used to group expressions, isolate conditional expressions and
indicate function calls and function declarations:
d = c * (a + b)          
' Override normal precedence
if (d = z) 
then ...      
' Useful with conditional statements
func()                        ' Function call, no arguments
sub function func2(dim as word)' Function declaration w/ parameters
For more information, refer to Operators Precedence and Associativity, Expressions,
or Functions and Procedures.
Comma
Comma (
,
) separates the arguments in function calls:
Lcd_Out(1, 1, txt)
Furthermore, the comma separates identifiers in declarations:
dim i, j, k as word
The comma also separates elements in initialization lists of constant arrays:
const MONTHS as byte[12] = (31,28,31,30,31,30,31,31,30,31,30,31)
118
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroBasic PRO for AVR
CHAPTER 5