diff --git a/cy-GB/images/changing-operator.gif b/cy-GB/images/changing-operator.gif new file mode 100644 index 0000000..8144cba Binary files /dev/null and b/cy-GB/images/changing-operator.gif differ diff --git a/cy-GB/images/comparison-blocks.png b/cy-GB/images/comparison-blocks.png new file mode 100644 index 0000000..1364508 Binary files /dev/null and b/cy-GB/images/comparison-blocks.png differ diff --git a/cy-GB/images/elseif-blocks.gif b/cy-GB/images/elseif-blocks.gif new file mode 100644 index 0000000..fe69fb2 Binary files /dev/null and b/cy-GB/images/elseif-blocks.gif differ diff --git a/cy-GB/images/if-block-location.png b/cy-GB/images/if-block-location.png new file mode 100644 index 0000000..05a1ba9 Binary files /dev/null and b/cy-GB/images/if-block-location.png differ diff --git a/cy-GB/meta.yml b/cy-GB/meta.yml new file mode 100644 index 0000000..0dbb751 --- /dev/null +++ b/cy-GB/meta.yml @@ -0,0 +1,10 @@ +title: Selection +hero_image: images/banner.png +description: How to use if blocks for selection on the micro:bit +version: 4 +listed: false +copyedit: false +last_tested: "2022-05-19" +steps: + - + title: Using if blocks for selection on the micro:bit diff --git a/cy-GB/step_1.md b/cy-GB/step_1.md new file mode 100644 index 0000000..845612b --- /dev/null +++ b/cy-GB/step_1.md @@ -0,0 +1,77 @@ +There might be times when you want a specific part of your program to run **only** when a certain condition is met. In programming, this is called **selection**. + +In MakeCode, the most important block you will use for selection is the `if`{:class='microbitlogic'} block. + +### Using an if block + +You will find the `if`{:class='microbitlogic'} block in the `Logic`{:class='microbitlogic'} menu. + +The Logic menu with the `if` block highlighted. + +You have to put `if`{:class='microbitlogic'} blocks inside other blocks, like `forever`{:class='microbitbasic'} loops or an `on button pressed`{:class='microbitinput'} block. + +You can place other blocks **inside** an `if`{:class='microbitlogic'} block, and they will only run **if** the condition is `true`. + +### The condition + +An important part of the `if`{:class='microbitlogic'} block is the **condition**. The blocks inside an `if`{:class='microbitlogic'} will only run if a condition is `true`. + +You can find the condition blocks in the `Logic`{:class='microbitlogic'} menu of the Toolbox. + +The Comparison section of the Logic menu, with three blocks showing: 0 = 0, 0 >
+
+A condition has two parts:
+
+1. Data
+2. An operator
+
+**Data**
+
+There has to be data on either side of your condition. This can be a variable, a sensor reading, a `true/false`, or a number.
+
+**Operator**
+
+The operators is **how** you are comparing the two pieces of data.
+
+You can think of the operator like a question you are asking about your two pieces of data.
+
+The operators you can use are:
+
+- `=` — are the two sides **equal**?
+- `≠` — are the two sides **not equal**?
+- `>` — is the first piece of data **greater than** the second?
+- `<` — is the first piece of data **less than** the second?
+- `≥` — is the first piece of data **greater than or equal to** the second?
+- `≤` — is the first piece of data **less than or equal to** the second?
+
+You can choose an operator by dragging a comparison block into your `if`{:class='microbitlogic'} block and clicking on the drop-down menu.
+
+<img src= + +#### else if and else + +You can also add more possible outcomes to your `if`{:class='microbitlogic'} block with `else`{:class='microbitlogic'} and `else if`{:class='microbitlogic'} blocks. + +**else** + +Sometimes you might want some code to run if the condition in your `if`{:class='microbitlogic'} block is `false`. To do this, you can use an `else`{:class='microbitlogic'}. + +The blocks inside the `else`{:class='microbitlogic'} part will run **only** when the condition is `false`. + +To add an `else`{:class='microbitlogic'}, you need to click the `+` symbol at the bottom of your `if`{:class='microbitlogic'} block. + +There is also an `if else`{:class='microbitlogic'} block that you can use if you know you will need to do one thing if a condition is true and another if a condition is false. + +**else if** + +An `else if`{:class='microbitlogic'} block allows you to add another condition to check. + +**It will only check the second condition if the first condition is `false`. If you always want both conditions to be checked, you have to add a second `if`{:class='microbitlogic'} block.** + +To add an `else if`{:class='microbitlogic'} block, you click the `+` symbol at the bottom of the `if`{:class='microbitlogic'} block. + +An animation showing the + symbol being used to add three 'else if' sections. Finally, the 'else' is removed from the end by clicking the '-' symbol next to it. + +If you just want an `else if`{:class='microbitlogic'}, you will have to click the `+` twice and then `-` the `else`{:class='microbitlogic'}. + +You will then have to add another `condition`. diff --git a/el-GR/images/changing-operator.gif b/el-GR/images/changing-operator.gif new file mode 100644 index 0000000..8144cba Binary files /dev/null and b/el-GR/images/changing-operator.gif differ diff --git a/el-GR/images/comparison-blocks.png b/el-GR/images/comparison-blocks.png new file mode 100644 index 0000000..1364508 Binary files /dev/null and b/el-GR/images/comparison-blocks.png differ diff --git a/el-GR/images/elseif-blocks.gif b/el-GR/images/elseif-blocks.gif new file mode 100644 index 0000000..fe69fb2 Binary files /dev/null and b/el-GR/images/elseif-blocks.gif differ diff --git a/el-GR/images/if-block-location.png b/el-GR/images/if-block-location.png new file mode 100644 index 0000000..05a1ba9 Binary files /dev/null and b/el-GR/images/if-block-location.png differ diff --git a/el-GR/meta.yml b/el-GR/meta.yml new file mode 100644 index 0000000..0dbb751 --- /dev/null +++ b/el-GR/meta.yml @@ -0,0 +1,10 @@ +title: Selection +hero_image: images/banner.png +description: How to use if blocks for selection on the micro:bit +version: 4 +listed: false +copyedit: false +last_tested: "2022-05-19" +steps: + - + title: Using if blocks for selection on the micro:bit diff --git a/el-GR/step_1.md b/el-GR/step_1.md new file mode 100644 index 0000000..845612b --- /dev/null +++ b/el-GR/step_1.md @@ -0,0 +1,77 @@ +There might be times when you want a specific part of your program to run **only** when a certain condition is met. In programming, this is called **selection**. + +In MakeCode, the most important block you will use for selection is the `if`{:class='microbitlogic'} block. + +### Using an if block + +You will find the `if`{:class='microbitlogic'} block in the `Logic`{:class='microbitlogic'} menu. + +The Logic menu with the `if` block highlighted. + +You have to put `if`{:class='microbitlogic'} blocks inside other blocks, like `forever`{:class='microbitbasic'} loops or an `on button pressed`{:class='microbitinput'} block. + +You can place other blocks **inside** an `if`{:class='microbitlogic'} block, and they will only run **if** the condition is `true`. + +### The condition + +An important part of the `if`{:class='microbitlogic'} block is the **condition**. The blocks inside an `if`{:class='microbitlogic'} will only run if a condition is `true`. + +You can find the condition blocks in the `Logic`{:class='microbitlogic'} menu of the Toolbox. + +The Comparison section of the Logic menu, with three blocks showing: 0 = 0, 0 >
+
+A condition has two parts:
+
+1. Data
+2. An operator
+
+**Data**
+
+There has to be data on either side of your condition. This can be a variable, a sensor reading, a `true/false`, or a number.
+
+**Operator**
+
+The operators is **how** you are comparing the two pieces of data.
+
+You can think of the operator like a question you are asking about your two pieces of data.
+
+The operators you can use are:
+
+- `=` — are the two sides **equal**?
+- `≠` — are the two sides **not equal**?
+- `>` — is the first piece of data **greater than** the second?
+- `<` — is the first piece of data **less than** the second?
+- `≥` — is the first piece of data **greater than or equal to** the second?
+- `≤` — is the first piece of data **less than or equal to** the second?
+
+You can choose an operator by dragging a comparison block into your `if`{:class='microbitlogic'} block and clicking on the drop-down menu.
+
+<img src= + +#### else if and else + +You can also add more possible outcomes to your `if`{:class='microbitlogic'} block with `else`{:class='microbitlogic'} and `else if`{:class='microbitlogic'} blocks. + +**else** + +Sometimes you might want some code to run if the condition in your `if`{:class='microbitlogic'} block is `false`. To do this, you can use an `else`{:class='microbitlogic'}. + +The blocks inside the `else`{:class='microbitlogic'} part will run **only** when the condition is `false`. + +To add an `else`{:class='microbitlogic'}, you need to click the `+` symbol at the bottom of your `if`{:class='microbitlogic'} block. + +There is also an `if else`{:class='microbitlogic'} block that you can use if you know you will need to do one thing if a condition is true and another if a condition is false. + +**else if** + +An `else if`{:class='microbitlogic'} block allows you to add another condition to check. + +**It will only check the second condition if the first condition is `false`. If you always want both conditions to be checked, you have to add a second `if`{:class='microbitlogic'} block.** + +To add an `else if`{:class='microbitlogic'} block, you click the `+` symbol at the bottom of the `if`{:class='microbitlogic'} block. + +An animation showing the + symbol being used to add three 'else if' sections. Finally, the 'else' is removed from the end by clicking the '-' symbol next to it. + +If you just want an `else if`{:class='microbitlogic'}, you will have to click the `+` twice and then `-` the `else`{:class='microbitlogic'}. + +You will then have to add another `condition`. diff --git a/fr-FR/images/changing-operator.gif b/fr-FR/images/changing-operator.gif new file mode 100644 index 0000000..8144cba Binary files /dev/null and b/fr-FR/images/changing-operator.gif differ diff --git a/fr-FR/images/comparison-blocks.png b/fr-FR/images/comparison-blocks.png new file mode 100644 index 0000000..1364508 Binary files /dev/null and b/fr-FR/images/comparison-blocks.png differ diff --git a/fr-FR/images/elseif-blocks.gif b/fr-FR/images/elseif-blocks.gif new file mode 100644 index 0000000..fe69fb2 Binary files /dev/null and b/fr-FR/images/elseif-blocks.gif differ diff --git a/fr-FR/images/if-block-location.png b/fr-FR/images/if-block-location.png new file mode 100644 index 0000000..05a1ba9 Binary files /dev/null and b/fr-FR/images/if-block-location.png differ diff --git a/fr-FR/meta.yml b/fr-FR/meta.yml new file mode 100644 index 0000000..0dbb751 --- /dev/null +++ b/fr-FR/meta.yml @@ -0,0 +1,10 @@ +title: Selection +hero_image: images/banner.png +description: How to use if blocks for selection on the micro:bit +version: 4 +listed: false +copyedit: false +last_tested: "2022-05-19" +steps: + - + title: Using if blocks for selection on the micro:bit diff --git a/fr-FR/step_1.md b/fr-FR/step_1.md new file mode 100644 index 0000000..845612b --- /dev/null +++ b/fr-FR/step_1.md @@ -0,0 +1,77 @@ +There might be times when you want a specific part of your program to run **only** when a certain condition is met. In programming, this is called **selection**. + +In MakeCode, the most important block you will use for selection is the `if`{:class='microbitlogic'} block. + +### Using an if block + +You will find the `if`{:class='microbitlogic'} block in the `Logic`{:class='microbitlogic'} menu. + +The Logic menu with the `if` block highlighted. + +You have to put `if`{:class='microbitlogic'} blocks inside other blocks, like `forever`{:class='microbitbasic'} loops or an `on button pressed`{:class='microbitinput'} block. + +You can place other blocks **inside** an `if`{:class='microbitlogic'} block, and they will only run **if** the condition is `true`. + +### The condition + +An important part of the `if`{:class='microbitlogic'} block is the **condition**. The blocks inside an `if`{:class='microbitlogic'} will only run if a condition is `true`. + +You can find the condition blocks in the `Logic`{:class='microbitlogic'} menu of the Toolbox. + +The Comparison section of the Logic menu, with three blocks showing: 0 = 0, 0 >
+
+A condition has two parts:
+
+1. Data
+2. An operator
+
+**Data**
+
+There has to be data on either side of your condition. This can be a variable, a sensor reading, a `true/false`, or a number.
+
+**Operator**
+
+The operators is **how** you are comparing the two pieces of data.
+
+You can think of the operator like a question you are asking about your two pieces of data.
+
+The operators you can use are:
+
+- `=` — are the two sides **equal**?
+- `≠` — are the two sides **not equal**?
+- `>` — is the first piece of data **greater than** the second?
+- `<` — is the first piece of data **less than** the second?
+- `≥` — is the first piece of data **greater than or equal to** the second?
+- `≤` — is the first piece of data **less than or equal to** the second?
+
+You can choose an operator by dragging a comparison block into your `if`{:class='microbitlogic'} block and clicking on the drop-down menu.
+
+<img src= + +#### else if and else + +You can also add more possible outcomes to your `if`{:class='microbitlogic'} block with `else`{:class='microbitlogic'} and `else if`{:class='microbitlogic'} blocks. + +**else** + +Sometimes you might want some code to run if the condition in your `if`{:class='microbitlogic'} block is `false`. To do this, you can use an `else`{:class='microbitlogic'}. + +The blocks inside the `else`{:class='microbitlogic'} part will run **only** when the condition is `false`. + +To add an `else`{:class='microbitlogic'}, you need to click the `+` symbol at the bottom of your `if`{:class='microbitlogic'} block. + +There is also an `if else`{:class='microbitlogic'} block that you can use if you know you will need to do one thing if a condition is true and another if a condition is false. + +**else if** + +An `else if`{:class='microbitlogic'} block allows you to add another condition to check. + +**It will only check the second condition if the first condition is `false`. If you always want both conditions to be checked, you have to add a second `if`{:class='microbitlogic'} block.** + +To add an `else if`{:class='microbitlogic'} block, you click the `+` symbol at the bottom of the `if`{:class='microbitlogic'} block. + +An animation showing the + symbol being used to add three 'else if' sections. Finally, the 'else' is removed from the end by clicking the '-' symbol next to it. + +If you just want an `else if`{:class='microbitlogic'}, you will have to click the `+` twice and then `-` the `else`{:class='microbitlogic'}. + +You will then have to add another `condition`. diff --git a/nl-NL/images/changing-operator.gif b/nl-NL/images/changing-operator.gif new file mode 100644 index 0000000..847759c Binary files /dev/null and b/nl-NL/images/changing-operator.gif differ diff --git a/nl-NL/images/comparison-blocks.png b/nl-NL/images/comparison-blocks.png new file mode 100644 index 0000000..d7b0334 Binary files /dev/null and b/nl-NL/images/comparison-blocks.png differ diff --git a/nl-NL/images/elseif-blocks.gif b/nl-NL/images/elseif-blocks.gif new file mode 100644 index 0000000..4a27949 Binary files /dev/null and b/nl-NL/images/elseif-blocks.gif differ diff --git a/nl-NL/images/if-block-location.png b/nl-NL/images/if-block-location.png new file mode 100644 index 0000000..fc12e4d Binary files /dev/null and b/nl-NL/images/if-block-location.png differ diff --git a/nl-NL/meta.yml b/nl-NL/meta.yml new file mode 100644 index 0000000..20109c6 --- /dev/null +++ b/nl-NL/meta.yml @@ -0,0 +1,10 @@ +title: Selectie +hero_image: images/banner.png +description: Hoe gebruik je als blokken voor selectie op de micro:bit +version: 4 +listed: false +copyedit: false +last_tested: "2022-05-19" +steps: + - + title: Als blokken gebruiken voor selectie op de micro:bit diff --git a/nl-NL/step_1.md b/nl-NL/step_1.md new file mode 100644 index 0000000..d324e4a --- /dev/null +++ b/nl-NL/step_1.md @@ -0,0 +1,77 @@ +Het kan voorkomen dat je wilt dat een specifiek onderdeel van jouw programma **alleen** wordt uitgevoerd als aan een bepaalde voorwaarde is voldaan. In programmeren heet dit **selectie**. + +In MakeCode is het belangrijkste blok dat je voor selectie gebruikt het `als`{:class='microbitlogic'} blok. + +### Een als blok gebruiken + +Je vindt het blok `als`{:class='microbitlogic'} in het menu `Logisch`{:class='microbitlogic'}. + +The Logic menu with the `if` block highlighted. + +Je moet `als`{:class='microbitlogic'} blokken in andere blokken zetten, zoals `de hele tijd`{:class='microbitbasic'} lussen of een `wanneer knop wordt ingedrukt`{:class='microbitinput'} blok. + +Je kunt andere blokken **binnen** een `als`{:class='microbitlogic'} blok plaatsen en ze zullen alleen werken **als** de voorwaarde `waar` is. + +### De voorwaarde + +Een belangrijk deel van het `als`{:class='microbitlogic'} blok is de **voorwaarde**. De blokken in een `als`{:class='microbitlogic'} blok worden alleen uitgevoerd als een voorwaarde `waar` is. + +Je kunt de voorwaarden blokken vinden in het menu `Logisch`{:class='microbitlogic'} van de Toolbox. + +The Comparison section of the Logic menu, with three blocks showing: 0 = 0, 0 >
+
+Een voorwaarde bestaat uit twee delen:
+
+1. Gegevens
+2. Een operator
+
+**Gegevens**
+
+Er moeten gegevens aan beide kanten van je voorwaarde staan. Dit kan een variabele, een uitlezing van een sensor zijn, een `waar/onwaar`, of een getal.
+
+**Operator**
+
+De operators bepalen **hoe** je de twee stukken gegevens met elkaar vergelijkt.
+
+Je kunt de operator beschouwen als een vraag die je stelt over je twee gegevens.
+
+De operators die je kan gebruiken zijn:
+
+- `=` - zijn de twee zijden **gelijk**?
+- `≠` — zijn de twee zijden **niet gelijk**?
+- `>` — is het eerste stukje gegevens **groter dan** het tweede?
+- `<` — is het eerste stukje gegevens **kleiner dan** het tweede?
+- `≥` — is het eerste stukje gegevens **groter dan of gelijk aan** het tweede?
+- `≤` — is het eerste stukje gegevens **kleiner dan of gelijk aan** het tweede?
+
+Je kunt een operator kiezen door een vergelijkingsblok in je `als`{:class='microbitlogic'} blok te slepen en op het vervolgkeuzemenu te klikken.
+
+<img src= + +#### anders als en anders + +Je kunt nog meer mogelijke resultaten toevoegen aan je `als`{:class='microbitlogic'} blok met `anders`{:class='microbitlogic'} en `anders als`{:class='microbitlogic'} blokken. + +**anders** + +Soms wil je dat wat code wordt uitgevoerd als de voorwaarde in je `als`{:class='microbitlogic'} blok `onwaar` is. Om dit te doen, kun je een `anders`{:class='microbitlogic'} blok gebruiken. + +De blokken in een `anders`{:class='microbitlogic'} blok worden alleen uitgevoerd als een voorwaarde `onwaar` is. + +Om een `anders`{:class='microbitlogic'} toe te voegen, moet je op het `+` symbool onder in je `als`{:class='microbitlogic'} blok klikken. + +Er is ook een `als anders`{:class='microbitlogic'} blok dat je kunt gebruiken als je weet dat je één ding moet doen als een voorwaarde waar is en een ander als een voorwaarde niet waar is. + +**anders als** + +Een `anders als`{:class='microbitlogic'} blok stelt je in staat een andere voorwaarde toe te voegen om te controleren. + +**Het zal alleen de tweede voorwaarde controleren als de eerste voorwaarde `onwaar` is. Als je altijd wilt dat beide voorwaarden worden gecontroleerd, moet je een tweede `als`{:class='microbitlogic'} blok toevoegen.** + +Om een `anders als`{:class='microbitlogic'} blok toe te voegen, klik je op het `+` symbool onderaan het `als`{:class='microbitlogic'} blok. + +An animation showing the + symbol being used to add three 'else if' sections. Finally, the 'else' is removed from the end by clicking the '-' symbol next to it. + +Als je alleen een `anders als`{:class='microbitlogic'} wilt, zul je twee keer op de `+` moeten klikken en vervolgens op de `-` van de `anders`{:class='microbitlogic'}. + +Je moet dan nog een `voorwaarde` toevoegen.