batch fixing ](/microbit/ -> ](/ links
This commit is contained in:
@ -10,11 +10,11 @@ Set or change the value of a variable
|
||||
let item = 0
|
||||
````
|
||||
|
||||
Use the assignment operator to set or change the value of a [variable](/microbit/reference/variables/var).
|
||||
Use the assignment operator to set or change the value of a [variable](/reference/variables/var).
|
||||
|
||||
### Declare a variable
|
||||
|
||||
Declare a new *local* variable using the [variable](/microbit/reference/variables/var) statement and the assignment operator. Like this:
|
||||
Declare a new *local* variable using the [variable](/reference/variables/var) statement and the assignment operator. Like this:
|
||||
|
||||
````blocks
|
||||
let num1 = 42;
|
||||
@ -28,13 +28,13 @@ let num1 = 42
|
||||
````
|
||||
### Notes
|
||||
|
||||
* You can use the assignment operator with variables of each of the supported [types](/microbit/blocks/types).
|
||||
* You can use the assignment operator with variables of each of the supported [types](/blocks/types).
|
||||
|
||||
### Lessons
|
||||
|
||||
[rotation animation](/microbit/lessons/rotation-animation)
|
||||
[rotation animation](/lessons/rotation-animation)
|
||||
|
||||
### See also
|
||||
|
||||
[variable](/microbit/reference/variables/var), [types](/microbit/blocks/types)
|
||||
[variable](/reference/variables/var), [types](/blocks/types)
|
||||
|
||||
|
@ -13,7 +13,7 @@ x += 1
|
||||
|
||||
### Declare a variable
|
||||
|
||||
Use the assignment operator to set the value of a [variable](/microbit/reference/variables/var). Change the value of a variable from 0 to 1 using the change item block. Like this:
|
||||
Use the assignment operator to set the value of a [variable](/reference/variables/var). Change the value of a variable from 0 to 1 using the change item block. Like this:
|
||||
|
||||
```blocks
|
||||
let x = 0
|
||||
@ -22,7 +22,7 @@ x += 1
|
||||
|
||||
### Example
|
||||
|
||||
Use the assignment operator to set the value of a [variable](/microbit/reference/variables/var). Change the value of a variable from 0 to 1 using the change item block. Then display the new value of the variable on the LED screen. Like this:
|
||||
Use the assignment operator to set the value of a [variable](/reference/variables/var). Change the value of a variable from 0 to 1 using the change item block. Then display the new value of the variable on the LED screen. Like this:
|
||||
|
||||
```blocks
|
||||
let x = 0;
|
||||
@ -32,9 +32,9 @@ basic.showNumber(x);
|
||||
|
||||
### Notes
|
||||
|
||||
* You can use the assignment operator with variables of each of the supported [types](/microbit/blocks/types).
|
||||
* You can use the assignment operator with variables of each of the supported [types](/blocks/types).
|
||||
|
||||
### See also
|
||||
|
||||
[variable](/microbit/reference/variables/var), [types](/microbit/blocks/types)
|
||||
[variable](/reference/variables/var), [types](/blocks/types)
|
||||
|
||||
|
@ -4,7 +4,7 @@ How to define and use local variables.
|
||||
|
||||
### @parent language
|
||||
|
||||
A variable is a place where you can store and retrieve data. Variables have a name, a [type](/microbit/blocks/types), and value:
|
||||
A variable is a place where you can store and retrieve data. Variables have a name, a [type](/blocks/types), and value:
|
||||
|
||||
* *name* is how you'll refer to the variable
|
||||
* *type* refers to the kind of data a variable can store
|
||||
@ -12,7 +12,7 @@ A variable is a place where you can store and retrieve data. Variables have a na
|
||||
|
||||
### Var statement
|
||||
|
||||
Use the Block Editor variable statement to create a local variable and the [assignment operator](/microbit/reference/variables/assign) to store something in the variable.
|
||||
Use the Block Editor variable statement to create a local variable and the [assignment operator](/reference/variables/assign) to store something in the variable.
|
||||
|
||||
For example, this code stores the number `2` in the `num1` variable:
|
||||
|
||||
@ -24,7 +24,7 @@ Here's how to define a variable in the Block Editor:
|
||||
|
||||
2. Change the default variable name if you like.
|
||||
|
||||
3. Drag a block type on the right-side of the [assignment operator](/microbit/reference/variables/assign) and click the down arrow to change the variable name.
|
||||
3. Drag a block type on the right-side of the [assignment operator](/reference/variables/assign) and click the down arrow to change the variable name.
|
||||
|
||||
The resulting code should look something like this:
|
||||
|
||||
@ -44,13 +44,13 @@ The resulting code should look something like this:
|
||||
|
||||

|
||||
|
||||
See [Image](/microbit/blocks/image) for info on creating and using image variables.
|
||||
See [Image](/blocks/image) for info on creating and using image variables.
|
||||
|
||||
The resulting code should look something like this:
|
||||
|
||||

|
||||
|
||||
A variable is created for the number returned by the [brightness](/microbit/reference/led/brightness) function.
|
||||
A variable is created for the number returned by the [brightness](/reference/led/brightness) function.
|
||||
|
||||
### Using variables
|
||||
|
||||
@ -68,7 +68,7 @@ Variables help simplify your code. For example, instead of turning on LEDs one b
|
||||
|
||||

|
||||
|
||||
You can use a variable (`i`) and a [for loop](/microbit/reference/loops/for) to plot the same series of points (`i` is incremented by 1, each time the loop repeats):
|
||||
You can use a variable (`i`) and a [for loop](/reference/loops/for) to plot the same series of points (`i` is incremented by 1, each time the loop repeats):
|
||||
|
||||

|
||||
|
||||
@ -84,9 +84,9 @@ Local variables exist only within the function or block of code where they're de
|
||||
|
||||
### Lessons
|
||||
|
||||
[glowing pendulum](/microbit/lessons/glowing-pendulum), [love meter](/microbit/lessons/love-meter), [temperature](/microbit/lessons/temperature), [zoomer](/microbit/lessons/zoomer)
|
||||
[glowing pendulum](/lessons/glowing-pendulum), [love meter](/lessons/love-meter), [temperature](/lessons/temperature), [zoomer](/lessons/zoomer)
|
||||
|
||||
### See also
|
||||
|
||||
[types](/microbit/blocks/types), [assignment operator](/microbit/reference/variables/assign)
|
||||
[types](/blocks/types), [assignment operator](/reference/variables/assign)
|
||||
|
||||
|
Reference in New Issue
Block a user