又做了一个程序,这回是计数器,按A按钮会加,按B按钮会减,最低值为0. 嘻嘻!
- input.onButtonPressed(Button.A, function () {
- count += 1
- basic.showNumber(count)
- })
- input.onButtonPressed(Button.B, function () {
- count += -1
- if (count <= 0) {
- count = 0
- }
- basic.showNumber(count)
- })
- let count = 0
- basic.showNumber(0)
- count = 0
- basic.forever(function () {
-
- })
复制代码
|