pxt-calliope/docs/reference/js/statements.md

42 lines
1.4 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# statements, operators, and libaries
2016-04-02 01:22:47 +02:00
Statements, operators, and libraries.
2016-03-26 00:47:20 +01:00
### @parent js/language
TouchDevelop functions include statements and operators.
### Statements
TouchDevelop statements include:
* [break](/microbit/js/break), to exit a loop before it has completed, usually used in conjunction with an [if](/microbit/reference/logic/if) statement
* [if](/microbit/reference/logic/if) conditional statement
* [for](/microbit/reference/loops/for) and [while](/microbit/js/while) loops
* [function](/microbit/js/function)
* [return](/microbit/js/return)
* [var](/microbit/reference/variables/var) (local variable declaration)
### Operators
TouchDevelop operators include:
* [assignment operator](/microbit/reference/variables/assign) `:=` (to update variables)
* arithmetic operators (`+`, `-`, `*`, `/`, mod) operate on [Numbers](/microbit/reference/types/number)
* comparison operators (such as `>`, `=`) operate on [Numbers](/microbit/reference/types/number)
* boolean operators (`not`, `or`, `and`) operate on [Booleans](/microbit/reference/types/boolean)
* concat operator combines [Strings](/microbit/reference/types/string)
### Libraries
Libraries provide additional functions:
* the [micro:bit library](/microbit/js/contents)
* the [math](/microbit/js/math) and [bits](/microbit/js/bits) libraries
### see also
[TouchDevelop Documentation](/microbit/js/contents), [comments](/microbit/js/comment)