1. If

        Run code depending on whether a boolean condition is true or false.

        if(true) {}

        The code inside the if block only runs when the condition block is true. You can compare variables to values or variables to variables, for a true condition.

        let reward = false;let perfect = 0;let myScore = 0;if (myScore < 10) {    myScore += 1;}if (myScore == perfect) {    reward = true;}

        Opposite condition: else

        If you want some other code to run when the opposite condition is true, you put it in an additional block area called else.

        let colorMix = 0;let favColor = "orange";if (favColor == "blue"){    colorMix = 7;} else {    colorMix = 472;}

        Opposite condition, but check something again: else if

        Another conditional action is to add an if to an else for an else if. It works like this:

        let reward = false;let nearPerfect = 0let perfect = 0let myScore = 0;if (myScore < 10) {    myScore += 1;}if (myScore == perfect) {    reward = true;} else if (myScore == nearPerfect) {    reward = true;}

        You might guess that a longer way of saying the same thing is this:

        let reward = false;let nearPerfect = 0;let perfect = 0;let myScore = 0;if (myScore < 10) {    myScore += 1;}if (myScore == perfect) {    reward = true;} else {    if (myScore == nearPerfect) {        reward = true;    }}

        Click on the plus (+) symbol to add else or else if sections to the current if block.

        Example: adjusting screen brightness

        If the light level is < 100, this code sets the brightness to 255 when the button A is pressed:

        input.onButtonPressed(Button.A, () => {    if(input.lightLevel()<100){        led.setBrightness(255);    }})

            1. http://www.i4u1dv3p.tw | http://m.i4u1dv3p.tw | http://wap.i4u1dv3p.tw | http://3g.i4u1dv3p.tw | http://4g.i4u1dv3p.tw | http://5g.i4u1dv3p.tw | http://mobile.i4u1dv3p.tw | http://vip.i4u1dv3p.tw | http://ios.i4u1dv3p.tw | http://anzhuo.i4u1dv3p.tw | http://223.i4u1dv3p.tw | http://1b320.i4u1dv3p.tw | http://37.i4u1dv3p.tw | http://68b689.i4u1dv3p.tw | http://14.i4u1dv3p.tw | http://f.i4u1dv3p.tw | 女主无情又渣快穿文