pxt-calliope/docs/reference/basic/show-number.md
2016-04-15 15:53:20 -07:00

1.2 KiB

Show Number

Show a number on the LED screen, one digit at a time (scrolling from left to right)

basic.showNumber(2, 150)

Parameters

  • value - a Number
  • (optional) interval (ms) - Number; the time (in milliseconds) before scrolling by one LED; the larger the number, the slower the scroll

~

To display the number 10:

basic.showNumber(10)

To display the number stored in the x variable:

let x = 1
basic.showNumber(x)

Example: count to 5

This example uses a for loop to show numbers 1 through 5 on the screen:

for (let i = 0; i < 5; i++) {
    basic.showNumber(i + 1)
    basic.pause(200)
}

Other show functions

Lessons

See also

show string, show animation, Number, math library