2016-03-26 00:47:20 +01:00
# Show Number
2016-05-19 22:46:02 +02:00
Show a number on the [LED screen ](/device/screen ). It will slide left if it has more than one digit.
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
```sig
basic.showNumber(2)
```
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
## Parameters
2016-03-26 00:47:20 +01:00
2022-08-10 18:36:19 +02:00
* `value` is a [Number ](/types/number ). If the number is not single-digit number, it will scroll on the display.
2019-12-02 05:58:26 +01:00
* `interval` is an optional [Number ](/types/number ). It means the number of milliseconds before sliding the `value` left by one LED each time. Bigger intervals make the sliding slower.
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
## Examples:
2016-03-26 00:47:20 +01:00
2016-05-19 22:46:02 +02:00
To show the number 10:
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
```blocks
2016-03-26 00:47:20 +01:00
basic.showNumber(10)
2019-12-02 05:58:26 +01:00
```
2016-03-26 00:47:20 +01:00
2016-05-20 01:50:02 +02:00
To show the number stored in a variable:
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
```blocks
2016-03-26 00:47:20 +01:00
let x = 1
basic.showNumber(x)
2019-12-02 05:58:26 +01:00
```
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
## Example: count to 5
2016-03-26 00:47:20 +01:00
2016-06-14 23:20:45 +02:00
This example uses a [for ](/blocks/loops/for ) loop to show numbers ``0`` through ``5`` on the screen:
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
```blocks
2016-05-19 22:46:02 +02:00
for (let i = 0; i < 6 ; i + + ) {
basic.showNumber(i)
2016-03-26 00:47:20 +01:00
basic.pause(200)
}
2019-12-02 05:58:26 +01:00
```
2016-03-26 00:47:20 +01:00
2022-08-10 18:36:19 +02:00
## Advanced
If `value` is `NaN` (not a number), `?` is displayed.
2019-12-02 05:58:26 +01:00
## Other show functions
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
* Use [show string ](/reference/basic/show-string ) to show a [String ](/types/string ) with letters on the screen.
2016-05-20 01:50:02 +02:00
* Use [show animation ](/reference/basic/show-animation ) to show a group of pictures on the screen, one after another.
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
## See also
2016-03-26 00:47:20 +01:00
2019-12-02 05:58:26 +01:00
[show string ](/reference/basic/show-string ), [show animation ](/reference/basic/show-animation ), [Number ](/types/number ), [math ](/blocks/math )
2016-03-26 00:47:20 +01:00