diff --git a/docs/projects/stopwatch.md b/docs/projects/stopwatch.md index fc69cc893b0..ac977e6d459 100644 --- a/docs/projects/stopwatch.md +++ b/docs/projects/stopwatch.md @@ -11,7 +11,7 @@ This project turns the @boardname@ into a simple stopwatch. Pressing **A** start Use an event to run code when ``||input:button A is pressed||``. ```blocks -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { }) ``` @@ -22,7 +22,7 @@ in a variable ``||variables:start||``. This is the start time. ```blocks let start = 0 -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { start = input.runningTime() }) ``` @@ -32,7 +32,7 @@ input.onButtonPressed(Button.A, function () { Add an event to run code when ``||input:button B is pressed||``. ```blocks -input.onButtonPressed(Button.B, function () { +input.onButtonPressed(Button.B, function() { }) ``` @@ -43,7 +43,7 @@ and ``||variables:value||`` time. This is the elapsed millisecond since pressing ```blocks let start = 0; -input.onButtonPressed(Button.B, function () { +input.onButtonPressed(Button.B, function() { let elapsed = input.runningTime() - start; }) ``` @@ -55,7 +55,7 @@ Use ``||Math:integer division||`` to divide ``||variables:elapsed||`` by ``1000` ```blocks let start = 0; -input.onButtonPressed(Button.B, function () { +input.onButtonPressed(Button.B, function() { let elapsed = input.runningTime() - start; basic.showNumber(Math.idiv(elapsed, 1000)) }) @@ -70,5 +70,5 @@ Try your program in the simulator. Press **A** to start the stopwatch and press If you have a @boardname@ connected, click ``|Download|`` to transfer your code! ```template -input.onButtonPressed(Button.A, function () {}) +input.onButtonPressed(Button.A, function() {}) ``` diff --git a/docs/projects/tele-potato.md b/docs/projects/tele-potato.md index b024d22ba39..dde78c53743 100644 --- a/docs/projects/tele-potato.md +++ b/docs/projects/tele-potato.md @@ -55,7 +55,7 @@ To make the game less predictable, we use the ``||math:pick random||`` block to ```blocks let potato = 0 -input.onButtonPressed(Button.AB, function () { +input.onButtonPressed(Button.AB, function() { potato = randint(10, 20) }) ``` @@ -67,7 +67,7 @@ we have the potato and we can send it. After sending it, we set the **potato** v ```blocks let potato = 0 -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { if (potato > 0) { radio.sendNumber(potato) potato = -1 @@ -97,7 +97,7 @@ Making the clock tick down is done with a ``||loops:forever||`` loop. ```blocks let potato = 0 -basic.forever(function () { +basic.forever(function() { if (potato == 0) { basic.showIcon(IconNames.Skull) } @@ -122,18 +122,18 @@ let potato = 0 radio.onReceivedNumber(function (receivedNumber) { potato = receivedNumber }) -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { if (potato > 0) { radio.sendNumber(potato) potato = -1 } }) -input.onButtonPressed(Button.AB, function () { +input.onButtonPressed(Button.AB, function() { potato = randint(10, 20) }) radio.setGroup(1) potato = -1 -basic.forever(function () { +basic.forever(function() { if (potato == 0) { basic.showIcon(IconNames.Skull) } diff --git a/docs/projects/timing-gates.md b/docs/projects/timing-gates.md index d1ad95bd407..8586914fb56 100644 --- a/docs/projects/timing-gates.md +++ b/docs/projects/timing-gates.md @@ -48,7 +48,7 @@ basic.showLeds(` . . . . . . . . . . `) -input.onPinPressed(TouchPin.P0, function () {}) +input.onPinPressed(TouchPin.P0, function() {}) let t = 0 input.runningTime() t - 1 @@ -101,7 +101,7 @@ basic.showLeds(` . . . . . . . . . . `) -input.onPinPressed(TouchPin.P0, function () { +input.onPinPressed(TouchPin.P0, function() { basic.showLeds(` # . . . . # . . . . @@ -156,7 +156,7 @@ basic.showLeds(` . . . . . . . . . . `) -input.onPinPressed(TouchPin.P0, function () { +input.onPinPressed(TouchPin.P0, function() { basic.showLeds(` # . . . . # . . . . @@ -165,7 +165,7 @@ input.onPinPressed(TouchPin.P0, function () { # . . . . `) }) -input.onPinPressed(TouchPin.P1, function () { +input.onPinPressed(TouchPin.P1, function() { basic.showLeds(` # . . . # # . . . # @@ -195,7 +195,7 @@ basic.showLeds(` . . . . . . . . . . `) -input.onPinPressed(TouchPin.P0, function () { +input.onPinPressed(TouchPin.P0, function() { t0 = control.eventTimestamp() basic.showLeds(` # . . . . @@ -205,7 +205,7 @@ input.onPinPressed(TouchPin.P0, function () { # . . . . `) }) -input.onPinPressed(TouchPin.P1, function () { +input.onPinPressed(TouchPin.P1, function() { t1 = control.eventTimestamp() basic.showLeds(` # . . . # diff --git a/docs/projects/tug-of-led.md b/docs/projects/tug-of-led.md index 85d5e90fa4b..d3d8c0c416f 100644 --- a/docs/projects/tug-of-led.md +++ b/docs/projects/tug-of-led.md @@ -35,7 +35,7 @@ Add an event on ``||input:button A pressed||`` to change the ``||variables:rope| ```blocks let rope = 2 -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { rope += -0.1 }) ``` @@ -46,7 +46,7 @@ Add an event on ``||input:button B pressed||`` to change the ``||variables:rope| ```blocks let rope = 2 -input.onButtonPressed(Button.B, function () { +input.onButtonPressed(Button.B, function() { rope += 0.1 }) ``` diff --git a/docs/projects/turtle-scanner.md b/docs/projects/turtle-scanner.md index 75067ce4603..0da075a5965 100644 --- a/docs/projects/turtle-scanner.md +++ b/docs/projects/turtle-scanner.md @@ -18,7 +18,7 @@ The turtle scans the display over and over again. turtle.setPosition(0, 0) turtle.turnRight() turtle.setSpeed(20) -basic.forever(function () { +basic.forever(function() { turtle.forward(4) turtle.turnRight() turtle.forward(1) diff --git a/docs/projects/turtle-spiral.md b/docs/projects/turtle-spiral.md index e5f85460ebb..7866ace63ab 100644 --- a/docs/projects/turtle-spiral.md +++ b/docs/projects/turtle-spiral.md @@ -17,7 +17,7 @@ A turtle that spirals into the center of the display and back out again. ```blocks turtle.setPosition(0, 0) turtle.turnRight() -basic.forever(function () { +basic.forever(function() { for (let index = 0; index <= 4; index++) { turtle.forward(4 - index) turtle.turnRight() diff --git a/docs/projects/v2-blow-away.md b/docs/projects/v2-blow-away.md index bf1d94e27fb..d462e1bfe1c 100644 --- a/docs/projects/v2-blow-away.md +++ b/docs/projects/v2-blow-away.md @@ -29,7 +29,7 @@ basic.showIcon(IconNames.Ghost) 💡 Why do we need a [__*repeat loop*__](#repeatLoop "repeat code for a given number of times") when we already have a ``forever`` container? Because ``forever`` has an embedded delay that we want to avoid! ```blocks -basic.forever(function () { +basic.forever(function() { // @highlight for (let index = 0; index < 4; index++) { @@ -46,7 +46,7 @@ Haven hates noise and will blow away if things get too loud. Let's use an [__*if ► Snap ``||logic:<[0] [=] [0]>||`` in to **replace** the ``||logic:||`` condition for your ``||logic:if then||`` statement. ```blocks -basic.forever(function () { +basic.forever(function() { // @highlight for (let index = 0; index < 4; index++) { // @highlight @@ -67,7 +67,7 @@ We'll be using a [__*sound threshold*__](#soundThreshold "a number for how loud 💡 This means Haven will hear any sound above ``128``. ```blocks -basic.forever(function () { +basic.forever(function() { for (let index = 0; index < 4; index++) { // @highlight if (input.soundLevel() > 128) { @@ -96,7 +96,7 @@ To show Haven is blowing away, we want to move a random set of lights sideways. ```blocks let row = 0 -basic.forever(function () { +basic.forever(function() { for (let index = 0; index < 4; index++) { if (input.soundLevel() > 128) { // @highlight @@ -116,7 +116,7 @@ basic.forever(function () { ```blocks let col = 0 let row = 0 -basic.forever(function () { +basic.forever(function() { for (let index = 0; index < 4; index++) { if (input.soundLevel() > 128) { row = randint(0, 4) @@ -138,7 +138,7 @@ Time to move some lights around! ```blocks let col = 0 let row = 0 -basic.forever(function () { +basic.forever(function() { for (let index = 0; index < 4; index++) { if (input.soundLevel() > 128) { row = randint(0, 4) @@ -160,7 +160,7 @@ To create the animation effect of Haven blowing away, we will turn off (or ``unp ```blocks let col = 0 let row = 0 -basic.forever(function () { +basic.forever(function() { for (let index = 0; index < 4; index++) { if (input.soundLevel() > 128) { row = randint(0, 4) @@ -187,7 +187,7 @@ Notice how you have **three** blocks from the ``||led:Led||`` category. All thre ```blocks let col = 0 let row = 0 -basic.forever(function () { +basic.forever(function() { for (let index = 0; index < 4; index++) { if (input.soundLevel() > 128) { row = randint(0, 4) @@ -214,7 +214,7 @@ Right now, we are unplotting and replotting in the same spot. What we want to do ```blocks let col = 0 let row = 0 -basic.forever(function () { +basic.forever(function() { for (let index = 0; index < 4; index++) { if (input.soundLevel() > 128) { row = randint(0, 4) @@ -242,7 +242,7 @@ Check out the simulator! let col = 0 let row = 0 basic.showIcon(IconNames.Ghost) -basic.forever(function () { +basic.forever(function() { for (let index = 0; index < 4; index++) { if (input.soundLevel() > 128) { row = randint(0, 4) diff --git a/docs/projects/v2-cat-napping.md b/docs/projects/v2-cat-napping.md index 45b8adba6d7..717bee7a2c8 100644 --- a/docs/projects/v2-cat-napping.md +++ b/docs/projects/v2-cat-napping.md @@ -30,7 +30,7 @@ Let's give Lychee some control over when she wants to start and stop logging dat ```blocks let logging = false -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { logging = !(logging) }) ``` @@ -44,7 +44,7 @@ It would help to know when the @boardname@ is logging data and when it isn't. Fo ```blocks let logging = false -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { logging = !(logging) if (logging) { } else { @@ -60,7 +60,7 @@ input.onButtonPressed(Button.A, function () { ```blocks let logging = false -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { logging = !(logging) if (logging) { basic.showIcon(IconNames.Target) @@ -78,7 +78,7 @@ Let's now add an auditory indicator that your @boardname@ is logging data! ```blocks let logging = false -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { logging = !(logging) if (logging) { basic.showIcon(IconNames.Target) @@ -94,7 +94,7 @@ input.onButtonPressed(Button.A, function () { ```blocks let logging = false -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { logging = !(logging) if (logging) { basic.showIcon(IconNames.Target) @@ -114,7 +114,7 @@ Let's set up the data logging for Lychee! In order to get Lychee a good amount o 💡 1 minute is equivalent to 60000ms, which is what the number will automatically change to. ```blocks -loops.everyInterval(60000, function () { +loops.everyInterval(60000, function() { }) ``` @@ -127,7 +127,7 @@ Now, let's use an [__*if then*__](#ifthen "runs some code if a boolean condition ```blocks let logging = false -loops.everyInterval(60000, function () { +loops.everyInterval(60000, function() { if (logging) { } }) @@ -143,7 +143,7 @@ Lychee loves her sun spots because they provide a nice, sunny and warm place to ```blocks let logging = false -loops.everyInterval(60000, function () { +loops.everyInterval(60000, function() { if (logging) { //@highlight datalogger.log( @@ -161,7 +161,7 @@ loops.everyInterval(60000, function () { ```blocks let logging = false -loops.everyInterval(60000, function () { +loops.everyInterval(60000, function() { if (logging) { //@highlight datalogger.log( diff --git a/docs/projects/v2-clap-lights.md b/docs/projects/v2-clap-lights.md index e73a774fa8e..3cbd3f0caef 100644 --- a/docs/projects/v2-clap-lights.md +++ b/docs/projects/v2-clap-lights.md @@ -14,7 +14,7 @@ Let's learn how to use a clap 👏 to switch your @boardname@'s lights on and of ```blocks // @highlight -input.onSound(DetectedSound.Loud, function () { +input.onSound(DetectedSound.Loud, function() { }) ``` @@ -34,7 +34,7 @@ In this step, we'll be using an [__*if then / else*__](#ifthenelse "runs some co ```blocks let lightsOn = 0 -input.onSound(DetectedSound.Loud, function () { +input.onSound(DetectedSound.Loud, function() { // @highlight if (lightsOn) { @@ -52,7 +52,7 @@ input.onSound(DetectedSound.Loud, function () { ```blocks let lightsOn = 0 -input.onSound(DetectedSound.Loud, function () { +input.onSound(DetectedSound.Loud, function() { if (lightsOn) { // @highlight basic.showLeds(` @@ -74,7 +74,7 @@ input.onSound(DetectedSound.Loud, function () { ```blocks let lightsOn = 0 -input.onSound(DetectedSound.Loud, function () { +input.onSound(DetectedSound.Loud, function() { if (lightsOn) { basic.showLeds(` # # # # # @@ -100,7 +100,7 @@ Just like we'd toggle a light switch, each time we clap, we want to **flip** the ```blocks let lightsOn = false -input.onSound(DetectedSound.Loud, function () { +input.onSound(DetectedSound.Loud, function() { // @highlight lightsOn = !(lightsOn) if (lightsOn) { @@ -144,7 +144,7 @@ If you have a new @boardname@ (the one with the **shiny gold** logo at the top), ```blocks let lightsOn = false -input.onSound(DetectedSound.Loud, function () { +input.onSound(DetectedSound.Loud, function() { lightsOn = !(lightsOn) if (lightsOn) { basic.showLeds(` diff --git a/docs/projects/v2-morse-chat.md b/docs/projects/v2-morse-chat.md index 706017ca89d..f247e4a635c 100644 --- a/docs/projects/v2-morse-chat.md +++ b/docs/projects/v2-morse-chat.md @@ -14,7 +14,7 @@ Luckily, you can use your @boardname@ with sound to talk to Sky 👋 ► From the ``||radio:Radio||`` category, get ``||radio:radio send number [0]||`` and snap it into your empty ``||input:on logo [pressed]||`` container. ```blocks -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { radio.sendNumber(0) }) ``` @@ -27,9 +27,9 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () { ```blocks // @highlight -input.onLogoEvent(TouchButtonEvent.LongPressed, function () { +input.onLogoEvent(TouchButtonEvent.LongPressed, function() { }) -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { radio.sendNumber(0) }) ``` @@ -40,11 +40,11 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () { ► Set the number to be ``1``. ```blocks -input.onLogoEvent(TouchButtonEvent.LongPressed, function () { +input.onLogoEvent(TouchButtonEvent.LongPressed, function() { // @highlight radio.sendNumber(1) }) -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { radio.sendNumber(0) }) ``` @@ -245,10 +245,10 @@ radio.onReceivedNumber(function (receivedNumber) { } basic.clearScreen() }) -input.onLogoEvent(TouchButtonEvent.LongPressed, function () { +input.onLogoEvent(TouchButtonEvent.LongPressed, function() { radio.sendNumber(1) }) -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { radio.sendNumber(0) }) ``` @@ -283,10 +283,10 @@ radio.onReceivedNumber(function (receivedNumber) { } basic.clearScreen() }) -input.onLogoEvent(TouchButtonEvent.LongPressed, function () { +input.onLogoEvent(TouchButtonEvent.LongPressed, function() { radio.sendNumber(1) }) -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { radio.sendNumber(0) }) ``` \ No newline at end of file diff --git a/docs/projects/v2-pet-hamster.md b/docs/projects/v2-pet-hamster.md index 678d22c9c83..4b6f2801fdd 100644 --- a/docs/projects/v2-pet-hamster.md +++ b/docs/projects/v2-pet-hamster.md @@ -25,7 +25,7 @@ Pressing Cyrus's logo tickles them! ```blocks //@highlight -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { //@highlight basic.showIcon(IconNames.Happy) }) @@ -36,7 +36,7 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () { ► From the ``||music:Music||`` category, get a ``||music:play sound [giggle] until done||`` and add it to the **bottom** of your ``||input:on logo [pressed]||`` container. ```blocks -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { basic.showIcon(IconNames.Happy) //@highlight soundExpression.giggle.playUntilDone() @@ -52,7 +52,7 @@ Whenever Cyrus is shaken, they get sad 🙁 ```blocks //@highlight -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { //@highlight basic.showIcon(IconNames.Sad) }) @@ -64,7 +64,7 @@ input.onGesture(Gesture.Shake, function () { ► Click on the **dropdown** and set it so Cyrus plays a ``||music:sad||`` sound until done. ```blocks -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { basic.showIcon(IconNames.Sad) //@highlight soundExpression.sad.playUntilDone() @@ -79,13 +79,13 @@ Let's ensure that Cyrus will always go back to sleep after being shaken or tickl ► Snap your copied block in at the **very bottom** of your ``||input:on [shake]||`` container. ```blocks -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { basic.showIcon(IconNames.Sad) soundExpression.sad.playUntilDone() //@highlight basic.showIcon(IconNames.Asleep) }) -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { basic.showIcon(IconNames.Happy) soundExpression.giggle.playUntilDone() }) @@ -97,12 +97,12 @@ basic.showIcon(IconNames.Asleep) ► Duplicate the ``||basic:show icon[-_-]||`` block again and this time snap it in at the **very bottom** of your ``||input:on logo [pressed]||`` container. ```blocks -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { basic.showIcon(IconNames.Sad) soundExpression.sad.playUntilDone() basic.showIcon(IconNames.Asleep) }) -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { basic.showIcon(IconNames.Happy) soundExpression.giggle.playUntilDone() //@highlight @@ -122,12 +122,12 @@ Play with Cyrus to see how they react 🐹 If you have a new @boardname@ (the one with the **shiny gold** logo at the top), download this code and try it out! ```blocks -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { basic.showIcon(IconNames.Sad) soundExpression.sad.playUntilDone() basic.showIcon(IconNames.Asleep) }) -input.onLogoEvent(TouchButtonEvent.Pressed, function () { +input.onLogoEvent(TouchButtonEvent.Pressed, function() { basic.showIcon(IconNames.Happy) soundExpression.giggle.playUntilDone() basic.showIcon(IconNames.Asleep) diff --git a/docs/projects/v2-play-sound-long.md b/docs/projects/v2-play-sound-long.md index 29bcf083c01..e3decdabf9b 100644 --- a/docs/projects/v2-play-sound-long.md +++ b/docs/projects/v2-play-sound-long.md @@ -23,7 +23,7 @@ block into the ``||basic:forever||`` loop container. ```blocks -basic.forever(function(){ +basic.forever(function() { serial.writeValue("x", 0) }) ``` @@ -60,7 +60,7 @@ block. ```blocks -basic.forever(function(){ +basic.forever(function() { serial.writeValue("a", input.acceleration(Dimension.X)) }) ``` @@ -94,7 +94,7 @@ block. ```blocks -basic.forever(function(){ +basic.forever(function() { serial.writeValue("a", input.acceleration(Dimension.X)) }) ``` @@ -108,7 +108,7 @@ Don't forget to test your code in the simulator! If you have a new @boardname@ (the one with the **shiny gold** logo at the top), download this code and try it out! ```blocks -basic.forever(function () { +basic.forever(function() { serial.writeValue("Accel", input.acceleration(Dimension.X)) serial.writeValue("Compass", input.compassHeading()) music.playSoundEffect(music.createSoundEffect( @@ -126,7 +126,7 @@ basic.forever(function () { ```ghost -basic.forever(function () { +basic.forever(function() { serial.writeValue("Accel", input.acceleration(Dimension.X)) serial.writeValue("Compass", input.compassHeading()) music.playSoundEffect(music.createSoundEffect( diff --git a/docs/projects/v2-play-sound.md b/docs/projects/v2-play-sound.md index cc9f0f17692..d58981103c3 100644 --- a/docs/projects/v2-play-sound.md +++ b/docs/projects/v2-play-sound.md @@ -133,7 +133,7 @@ Congratulations, you are your own DJ! ```blocks -basic.forever(function () { +basic.forever(function() { music.playSoundEffect(music.createSoundEffect( WaveShape.Sine, input.acceleration(Dimension.X), @@ -149,7 +149,7 @@ basic.forever(function () { ```ghost -basic.forever(function () { +basic.forever(function() { serial.writeValue("Accel", input.acceleration(Dimension.X)) serial.writeValue("Rotation", input.rotation(Rotation.Pitch),) music.playSoundEffect(music.createSoundEffect( diff --git a/docs/projects/voting-machine.md b/docs/projects/voting-machine.md index 682a4c52b69..9786223a46a 100644 --- a/docs/projects/voting-machine.md +++ b/docs/projects/voting-machine.md @@ -21,7 +21,7 @@ Assuming button ``A`` is for a NO vote and ``B`` is for YES, the voter program w When button ``A`` is pressed, a number ``0`` is sent via radio and the ``X`` symbol is shown on the screen. ```block -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { radio.sendNumber(0) basic.showIcon(IconNames.No) }) @@ -32,7 +32,7 @@ input.onButtonPressed(Button.A, function () { When button ``B`` is pressed, a number ``255`` is sent via radio and the ``Y`` symbol is shown on the screen. ```block -input.onButtonPressed(Button.B, function () { +input.onButtonPressed(Button.B, function() { radio.sendNumber(255) basic.showIcon(IconNames.Yes) }) @@ -56,11 +56,11 @@ radio.setGroup(4) Putting all the parts together, here's the complete voter program: ```blocks -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { radio.sendNumber(0) basic.showIcon(IconNames.No) }) -input.onButtonPressed(Button.B, function () { +input.onButtonPressed(Button.B, function() { radio.sendNumber(255) basic.showIcon(IconNames.Yes) }) diff --git a/docs/projects/wallet/code.md b/docs/projects/wallet/code.md index d4c526faf2b..e908e0c8433 100644 --- a/docs/projects/wallet/code.md +++ b/docs/projects/wallet/code.md @@ -5,7 +5,7 @@ Let's start by using a combination of [forever](/reference/basic/forever) and [show leds](/reference/basic/show-leds) to create animation: ```blocks -basic.forever(function () { +basic.forever(function() { basic.showLeds(` # # . # # # # . # # @@ -34,7 +34,7 @@ How do we know that the wallet is in the pocket? It is really dark in there... W Using an [if statement](/blocks/logic/if), we can test if the level of light is sufficient to turn on the screen. Otherwise, we turn off the screen for a few second to save energy. ```blocks -basic.forever(function () { +basic.forever(function() { if (input.lightLevel() > 16) { basic.showLeds(` # # . # # diff --git a/docs/projects/watch/code.md b/docs/projects/watch/code.md index 1ce89cfd2ad..e2a8aaa2337 100644 --- a/docs/projects/watch/code.md +++ b/docs/projects/watch/code.md @@ -32,7 +32,7 @@ Ok, now we'll count and show all of your movements. ```blocks let motions = 0 -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { motions += 1 basic.showNumber(motions) }) @@ -47,7 +47,7 @@ If we want to start over from zero, then we need to have a way to reset the moti ```blocks let motions = 0 -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { motions = 0 basic.showNumber(motions) }) diff --git a/docs/projects/watch/digital-watch.md b/docs/projects/watch/digital-watch.md index ff227f8e5fc..0d54fa87ef7 100644 --- a/docs/projects/watch/digital-watch.md +++ b/docs/projects/watch/digital-watch.md @@ -39,7 +39,7 @@ So, let's try showing the time on the display. We aren't keeping time yet but we let time = "" let minutes = 0 let hours = 0 -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { time = hours + (":" + minutes) basic.showString(time) }) @@ -59,7 +59,7 @@ Let's make a way to set the hours for the watch. ```blocks let hours = 0 -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { if (hours < 23) { hours += 1 } else { @@ -77,7 +77,7 @@ Setting minutes is almost the same as setting hours but with just a few changes. ```blocks let minutes = 0 -input.onButtonPressed(Button.B, function () { +input.onButtonPressed(Button.B, function() { if (minutes < 59) { minutes += 1 } else { @@ -96,7 +96,7 @@ Time is shown in either 24 hour or 12 hour format. We'll use one more button to ```blocks let ampm = false -input.onButtonPressed(Button.AB, function () { +input.onButtonPressed(Button.AB, function() { ampm = !(ampm) }) ``` @@ -114,7 +114,7 @@ A watch really has three parts: the display, settings, and timer. We need a way ```blocks let minutes = 0; -basic.forever(function () { +basic.forever(function() { basic.pause(60000) if (minutes < 59) { minutes += 1 @@ -134,7 +134,7 @@ basic.forever(function () { ```blocks let minutes = 0 let hours = 0 -basic.forever(function () { +basic.forever(function() { basic.pause(60000) if (minutes < 59) { minutes += 1 @@ -167,7 +167,7 @@ First, we have to code an adjustment for the hours number when we're using the 1 let hours = 0; let adjust = 0; let ampm = false; -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { adjust = hours; if (ampm) { if (hours > 12) { @@ -199,7 +199,7 @@ let hours = 0 let adjust = 0 let time = "" let ampm = false -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { adjust = hours if (ampm) { if (hours > 12) { @@ -235,7 +235,7 @@ let hours = 0 let adjust = 0 let time = "" let ampm = false -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { adjust = hours; if (ampm) { if (hours > 12) { diff --git a/docs/projects/watch/timer.md b/docs/projects/watch/timer.md index bb5642c09bc..0e5af6e86b7 100644 --- a/docs/projects/watch/timer.md +++ b/docs/projects/watch/timer.md @@ -35,7 +35,7 @@ We'll use button `A` to add `10` seconds to our time count. The time count of `s ```blocks let seconds = 0; -input.onButtonPressed(Button.A, function () { +input.onButtonPressed(Button.A, function() { if (seconds < 50) { seconds += 10; basic.showNumber(seconds) @@ -57,7 +57,7 @@ Now, we'll use the `B` button to add just `1` second the time count. The time co ```blocks let seconds = 0; -input.onButtonPressed(Button.B, function () { +input.onButtonPressed(Button.B, function() { if (seconds < 60) { seconds += 1 basic.showNumber(seconds) @@ -77,7 +77,7 @@ Ok, now we'll get the timer going and show how many seconds are left. This will ```blocks let seconds = 0; -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { while (seconds > 0) { basic.showNumber(seconds); basic.pause(1000); @@ -91,7 +91,7 @@ Add a few ``||basic:show icon||`` blocks at the bottom of the ``||loops:while||` ```blocks let seconds = 0; -input.onGesture(Gesture.Shake, function () { +input.onGesture(Gesture.Shake, function() { while (seconds > 0) { basic.showNumber(seconds) basic.pause(1000)