/reference/types -> /types

This commit is contained in:
Peli de Halleux
2017-03-16 07:57:41 -07:00
parent 69bd0225ad
commit 00e9217e73
116 changed files with 224 additions and 361 deletions

View File

@ -12,12 +12,12 @@ The Bits library includes functions for bit-level manipulation of integers. In t
#### Syntax
bits `->` *and/or/xor* uint32 (x : [Number](/reference/types/number), y : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
bits `->` *and/or/xor* uint32 (x : [Number](/types/number), y : [Number](/types/number)) *returns* [Number](/types/number)
#### Parameters
* x - an unsigned 32 bit integer [Number](/reference/types/number)
* y - another unsigned 32 bit integer [Number](/reference/types/number)
* x - an unsigned 32 bit integer [Number](/types/number)
* y - another unsigned 32 bit integer [Number](/types/number)
### and uint32
@ -37,14 +37,14 @@ Rotate bits to the left or the right, by the specified number of positions.
#### Syntax
bits `->` rotate left unint32 (x : [Number](/reference/types/number), bits : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
bits `->` rotate left unint32 (x : [Number](/types/number), bits : [Number](/types/number)) *returns* [Number](/types/number)
bits `->` rotate right unint32 (x : [Number](/reference/types/number), bits : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
bits `->` rotate right unint32 (x : [Number](/types/number), bits : [Number](/types/number)) *returns* [Number](/types/number)
#### Parameters
* x - [Number](/reference/types/number);
* bits - [Number](/reference/types/number);
* x - [Number](/types/number);
* bits - [Number](/types/number);
## Shift left and shift right
@ -52,16 +52,16 @@ Shift bits to the left or the right, by the specified number of positions.
#### Syntax
bits `->` shift left unint32 (x : [Number](/reference/types/number), bits : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
bits `->` shift left unint32 (x : [Number](/types/number), bits : [Number](/types/number)) *returns* [Number](/types/number)
bits `->` shift right unint32 (x : [Number](/reference/types/number), bits : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
bits `->` shift right unint32 (x : [Number](/types/number), bits : [Number](/types/number)) *returns* [Number](/types/number)
#### Parameters
* x - [Number](/reference/types/number);
* bits - [Number](/reference/types/number);
* x - [Number](/types/number);
* bits - [Number](/types/number);
### See also
[statements and operators](/javascript/statements), [math functions](/javascript/math), [Number](/reference/types/number)
[statements and operators](/javascript/statements), [math functions](/javascript/math), [Number](/types/number)

View File

@ -19,7 +19,7 @@ Type a function name in your code to call an existing [function](/javascript/fun
### Example: the square function
Here's a function called `square`, with a [Number](/reference/types/number) input parameter:
Here's a function called `square`, with a [Number](/types/number) input parameter:
```
/**

View File

@ -31,9 +31,9 @@ Welcome to the Touch Develop home page for the @boardname@. Below you will find
### Types
* [Number](/reference/types/number)
* [Boolean](/reference/types/boolean)
* [String](/reference/types/string)
* [Number](/types/number)
* [Boolean](/types/boolean)
* [String](/types/string)
* [Image](/reference/images/image)
### Statements and control structures
@ -50,19 +50,19 @@ Welcome to the Touch Develop home page for the @boardname@. Below you will find
### Maths
* arithmetic operators (`+`, `-`, `*`, `/`, mod) on [Numbers](/reference/types/number)
* comparison operators (such as `>`, `=`) on [Numbers](/reference/types/number)
* arithmetic operators (`+`, `-`, `*`, `/`, mod) on [Numbers](/types/number)
* comparison operators (such as `>`, `=`) on [Numbers](/types/number)
* the [math](/js/math) library
* the [bits](/js/bits) library
### Logical
* [Boolean](/reference/types/boolean) values `true` and `false`
* Operations (`not`, `or`, `and`) on [Booleans](/reference/types/boolean)
* [Boolean](/types/boolean) values `true` and `false`
* Operations (`not`, `or`, `and`) on [Booleans](/types/boolean)
### Strings
* [string functions](/reference/types/string-functions)
* [string functions](/types/string-functions)
### Functions

View File

@ -61,8 +61,8 @@ export function square(x: number) : number {
In the above code...
* ``x `` is the [input parameter](/js/functionparameters) ([Number](/reference/types/number) type)
* ``result`` is the [output parameter](/js/functionparameters) ([Number](/reference/types/number) type)
* ``x `` is the [input parameter](/js/functionparameters) ([Number](/types/number) type)
* ``result`` is the [output parameter](/js/functionparameters) ([Number](/types/number) type)
* `return x * x` is the function body (which returns the value of the expression `x * x`)
### Add function parameters

View File

@ -25,18 +25,18 @@ export function doStuff() {
#### Input parameters
The default type for an input parameter is [Number](/reference/types/number):
The default type for an input parameter is [Number](/types/number):
```
export function oneInput(p: number) {
}
```
To change the default type, click the type ([Number](/reference/types/number) in this case) and change it to [String](/reference/types/string), [Boolean](/reference/types/boolean), or [Image](/reference/image/image). You can add multiple input parameters to a function.
To change the default type, click the type ([Number](/types/number) in this case) and change it to [String](/types/string), [Boolean](/types/boolean), or [Image](/reference/image/image). You can add multiple input parameters to a function.
#### Output parameter
the default type for an output parameter is [Number](/reference/types/number):
the default type for an output parameter is [Number](/types/number):
```
export function output() : number {
@ -46,7 +46,7 @@ export function output() : number {
}
```
To change the default type, click the type ([Number](/reference/types/number) in this case) and change it to [String](/reference/types/string), [Boolean](/reference/types/boolean), or [Image](/reference/image/image).
To change the default type, click the type ([Number](/types/number) in this case) and change it to [String](/types/string), [Boolean](/types/boolean), or [Image](/reference/image/image).
### Inputs and output function

View File

@ -35,7 +35,7 @@ Overview of TouchDevelop lessons for the @boardname@.
* [global variables ](/nkecii) `guided tutorial`
* [local variable - create image, show image](/dcvnwv)
* data types: [number](/reference/types/number), [boolean](/reference/types/boolean), [string](/reference/types/string), [image](/reference/image/image)
* data types: [number](/types/number), [boolean](/types/boolean), [string](/types/string), [image](/reference/image/image)
### Statements and control structures
@ -52,18 +52,18 @@ Overview of TouchDevelop lessons for the @boardname@.
### Maths
* arithmetic operators (`+`, `-`, `*`, `/`, mod) on [numbers](/reference/types/number)
* comparison operators (such as `>`, `=`) on [numbers](/reference/types/number)
* arithmetic operators (`+`, `-`, `*`, `/`, mod) on [numbers](/types/number)
* comparison operators (such as `>`, `=`) on [numbers](/types/number)
* the [math](/js/math) library
* the [bits](/js/bits) library
### Logical
* boolean operators (`not`, `or`, `and`) on [booleans](/reference/types/boolean)
* boolean operators (`not`, `or`, `and`) on [booleans](/types/boolean)
### Strings
* concat operator combines [strings](/reference/types/string)
* concat operator combines [strings](/types/string)
### ~

View File

@ -5,7 +5,7 @@ Run code based on a condition.
### @parent javascript/language
Conditionally run code depending on whether a [Boolean](/reference/types/boolean) condition is true or false.
Conditionally run code depending on whether a [Boolean](/types/boolean) condition is true or false.
### Block Editor
@ -95,5 +95,5 @@ You can move an entire ``if`` block by clicking the ``if`` keyword and dragging
### See also
[while loop](/js/while), [for](/reference/loops/for), [boolean](/reference/types/boolean)
[while loop](/js/while), [for](/reference/loops/for), [boolean](/types/boolean)

View File

@ -24,7 +24,7 @@ Learn how to create a **break**, `break` to exit a while or for loop before the
## Documentation
* **Global Variable** : [read more...](/js/data)
* **Boolean** : [read more...](/reference/types/boolean)
* **Boolean** : [read more...](/types/boolean)
* **On Button Pressed** : [read more...](/reference/input/on-button-pressed)
* **While Loop** : [read more...](/js/while)
* **Break** : [read more...](/js/break)

View File

@ -38,8 +38,8 @@ Learn how to create a guessing game with **global variables** `var str: "this is
## Documentation
* **string** : [read more...](/reference/types/string)
* **string functions** : [read more...](/reference/types/string-functions)
* **string** : [read more...](/types/string)
* **string functions** : [read more...](/types/string-functions)
* **show string** : [read more...](/reference/basic/show-string)
* **local variables** : [read more...](/reference/variables/var)
* **assignment operator** : [read more...](/reference/variables/assign)

View File

@ -26,8 +26,8 @@ Learn how to create **functions**, `function()` that perform a specific task and
* **return** : [read more...](/js/return)
* **call** : [read more...](/js/call)
* **global variable** : [read more...](/js/data)
* **arithmetic operator** : [read more...](/reference/types/number)
* **Boolean** : [read more...](/reference/types/boolean)
* **arithmetic operator** : [read more...](/types/number)
* **Boolean** : [read more...](/types/boolean)
* **forever** : [read more...](/reference/basic/forever)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **if** : [read more...](/reference/logic/if)

View File

@ -25,7 +25,7 @@ Learn how to create **functions**, `function()` that perform a specific task and
* **function** : [read more...](/js/function)
* **call** : [read more...](/js/call)
* **global variable** : [read more...](/js/data)
* **arithmetic operators** : [read more...](/reference/types/number)
* **arithmetic operators** : [read more...](/types/number)
* **math random** : [read more...](/js/math)
* **forever** : [read more...](/reference/basic/forever)
* **for** : [read more...](/reference/loops/for)

View File

@ -44,7 +44,7 @@ Learn how to create **functions**, `function()` that perform a specific task and
* **return** : [read more...](/js/return)
* **call** : [read more...](/js/call)
* **global variable** : [read more...](/js/data)
* **arithmetic operator** : [read more...](/reference/types/number)
* **arithmetic operator** : [read more...](/types/number)
* **Boolean** : [/td/Boolean]()
* **forever** : [read more...](/reference/basic/forever)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)

View File

@ -4,7 +4,7 @@ Functions in the math library.
### @parent javascript/language
The math library includes math related functions that you can use with [Numbers](/reference/types/number).
The math library includes math related functions that you can use with [Numbers](/types/number).
* In the [TouchDevelop editor](/js/editor), click `math` to access the functions described below
* In the [Block editor](/blocks/editor), click **maths** on the left to see the available blocks
@ -13,7 +13,7 @@ The functions available in Touch Develop are:
### abs
math `->` abs (x : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
math `->` abs (x : [Number](/types/number)) *returns* [Number](/types/number)
returns the absolute value of input parameter `x`
@ -23,7 +23,7 @@ basic.showNumber(math.abs(-7), 150)
### clamp
math `->` clamp (min : [Number](/reference/types/number), max : [Number](/reference/types/number), value : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
math `->` clamp (min : [Number](/types/number), max : [Number](/types/number), value : [Number](/types/number)) *returns* [Number](/types/number)
limits a number to a range (between a min and max number); returns `min` if `value` is < `min`; returns `max` if `value` is > `max`; otherwise, returns `value`.
@ -33,7 +33,7 @@ basic.showNumber(td.clamp(5, 9, 12), 150)
### max
math `->` max (x : [Number](/reference/types/number), y : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
math `->` max (x : [Number](/types/number), y : [Number](/types/number)) *returns* [Number](/types/number)
returns the larger of two input numbers (`x` and `y`)
@ -43,7 +43,7 @@ basic.showNumber(Math.max(9, 7), 150)
### min
math `->` min (x : [Number](/reference/types/number), y : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
math `->` min (x : [Number](/types/number), y : [Number](/types/number)) *returns* [Number](/types/number)
returns the smaller of two input numbers (`x` and `y`)
@ -53,7 +53,7 @@ basic.showNumber(Math.min(9, 7), 150)
### mod
math `->` mod (x : [Number](/reference/types/number), y : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
math `->` mod (x : [Number](/types/number), y : [Number](/types/number)) *returns* [Number](/types/number)
returns the integer modulus/remainder resulting from the division of the number `x` by the number `y`
@ -63,7 +63,7 @@ basic.showNumber(math.mod(9, 7), 150)
### pow
math `->` pow (base : [Number](/reference/types/number), exp : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
math `->` pow (base : [Number](/types/number), exp : [Number](/types/number)) *returns* [Number](/types/number)
returns the value of the number `base` raised to the power `exp`
@ -73,9 +73,9 @@ basic.showNumber(math.pow(3, 3), 150)
### random
math `->` random (limit : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
math `->` random (limit : [Number](/types/number)) *returns* [Number](/types/number)
returns a random [Number](/reference/types/number) between 0 and the parameter *limit* - 1
returns a random [Number](/types/number) between 0 and the parameter *limit* - 1
```
basic.showNumber(Math.random(10), 150)
@ -83,7 +83,7 @@ basic.showNumber(Math.random(10), 150)
### sign
math `->` sign (x : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
math `->` sign (x : [Number](/types/number)) *returns* [Number](/types/number)
returns the sign of input parameter `x`
@ -97,5 +97,5 @@ basic.showNumber(math.sign(-7), 150)
### See also
[Bits library](/js/bits), [TouchDevelop documentation](/js/contents), [Number](/reference/types/number)
[Bits library](/js/bits), [TouchDevelop documentation](/js/contents), [Number](/types/number)

View File

@ -19,7 +19,7 @@ To declare a *global* number variable, see [global variables](/js/data).
### Arithmetic operators
The following arithmetic operators work on numbers and return a [Number](/reference/types/number):
The following arithmetic operators work on numbers and return a [Number](/types/number):
* addition: `1 + 3`
* subtraction: `1 - 3 `
@ -29,7 +29,7 @@ The following arithmetic operators work on numbers and return a [Number](/refere
### Relational operators
The following relational operators work on numbers and return a [Boolean](/reference/types/boolean):
The following relational operators work on numbers and return a [Boolean](/types/boolean):
* equality: `(3 + 1) = 4`
* inequality: `3 != 4`
@ -64,7 +64,7 @@ number1 = math.mod(4, 3)
### Convert a number to a string
The `to string` function converts a Number into a [String](/reference/types/string). The following code converts `number1` to a string and stores the string in the `str` variable:
The `to string` function converts a Number into a [String](/types/string). The following code converts `number1` to a string and stores the string in the `str` variable:
```
let str = number1.toString()
@ -80,5 +80,5 @@ The [bits library](/js/bits) includes functions for bit-level manipulation of in
### See also
[math library](/js/math), [var](/reference/variables/var), [bits library](/js/bits), [Boolean](/reference/types/boolean), [show number](/reference/basic/show-number)
[math library](/js/math), [var](/reference/variables/var), [bits library](/js/bits), [Boolean](/types/boolean), [show number](/reference/basic/show-number)

View File

@ -23,10 +23,10 @@ TouchDevelop statements include:
TouchDevelop operators include:
* [assignment operator](/reference/variables/assign) `:=` (to update variables)
* arithmetic operators (`+`, `-`, `*`, `/`, mod) operate on [Numbers](/reference/types/number)
* comparison operators (such as `>`, `=`) operate on [Numbers](/reference/types/number)
* boolean operators (`not`, `or`, `and`) operate on [Booleans](/reference/types/boolean)
* concat operator combines [Strings](/reference/types/string)
* arithmetic operators (`+`, `-`, `*`, `/`, mod) operate on [Numbers](/types/number)
* comparison operators (such as `>`, `=`) operate on [Numbers](/types/number)
* boolean operators (`not`, `or`, `and`) operate on [Booleans](/types/boolean)
* concat operator combines [Strings](/types/string)
### Libraries

View File

@ -34,11 +34,11 @@ find out if two strings are the same
#### Syntax
[String](/reference/types/string) `->` **equals** (other : [String](/reference/types/string)) *returns* [Boolean](/reference/types/boolean)
[String](/types/string) `->` **equals** (other : [String](/types/string)) *returns* [Boolean](/types/boolean)
#### Parameters
* other - [String](/reference/types/string); a string
* other - [String](/types/string); a string
#### Example
@ -56,11 +56,11 @@ get a character within a string, using the specified index
#### Syntax
[String](/reference/types/string) `->` **at** (index: [Number](/reference/types/number)) *returns* [String](/reference/types/string)
[String](/types/string) `->` **at** (index: [Number](/types/number)) *returns* [String](/types/string)
#### Parameters
* index- [Number](/reference/types/number); the character number within a string (0 returns the first character)
* index- [Number](/types/number); the character number within a string (0 returns the first character)
#### Example
@ -87,11 +87,11 @@ combine two strings; like the concat operator (`||`)
#### Syntax
[String](/reference/types/string) `->` **concat** (other : [String](/reference/types/string)) *returns* [String](/reference/types/string)
[String](/types/string) `->` **concat** (other : [String](/types/string)) *returns* [String](/types/string)
#### Parameters
* other- [String](/reference/types/string); a string
* other- [String](/types/string); a string
#### Example
@ -109,7 +109,7 @@ get the number of characters in a string
#### Syntax
[String](/reference/types/string) `->` **count** *returns* [Number](/reference/types/number)
[String](/types/string) `->` **count** *returns* [Number](/types/number)
#### Example
@ -125,12 +125,12 @@ get a portion of a string, using a starting point and length
#### Syntax
[String](/reference/types/string) `->` **substring** (start : [Number](/reference/types/number), length : [Number](/reference/types/number)) *returns* [String](/reference/types/string)
[String](/types/string) `->` **substring** (start : [Number](/types/number), length : [Number](/types/number)) *returns* [String](/types/string)
#### Parameters
* start - [Number](/reference/types/number); the starting character number (0 is the first character number in a string)
* length - [Number](/reference/types/number); the string length
* start - [Number](/types/number); the starting character number (0 is the first character number in a string)
* length - [Number](/types/number); the string length
#### Example
@ -146,7 +146,7 @@ converts the first character of a string into a character code number (unicode)
#### Syntax
[String](/reference/types/string) `->` **to character code** *returns* [Number](/reference/types/number)
[String](/types/string) `->` **to character code** *returns* [Number](/types/number)
#### Example
@ -162,7 +162,7 @@ converts a string into a number
#### Syntax
[String](/reference/types/string) `->` **to number** *returns* [Number](/reference/types/number)
[String](/types/string) `->` **to number** *returns* [Number](/types/number)
#### Example
@ -174,5 +174,5 @@ x = parseFloat(str)
### See also
[string](/reference/types/string), [number](/reference/types/number), [show string](/reference/basic/show-string)
[string](/types/string), [number](/types/number), [show string](/reference/basic/show-string)

View File

@ -44,7 +44,7 @@ The first parameter of `show string` specifies the string, and the second parame
### More string functions
Want to compare or concatenate strings? Check out the [string functions](/reference/types/string-functions).
Want to compare or concatenate strings? Check out the [string functions](/types/string-functions).
### Global string variables
@ -56,5 +56,5 @@ Unlike [local variables](/reference/variables/var), global variables are accessi
### See also
[local variables](/reference/variables/var), [global variables](/js/data), [string functions](/reference/types/string-functions), [Number](/reference/types/number), [show string](/reference/basic/show-string)
[local variables](/reference/variables/var), [global variables](/js/data), [string functions](/types/string-functions), [Number](/types/number), [show string](/reference/basic/show-string)

View File

@ -7,9 +7,9 @@ Touch Develop types.
A *type* refers to a class of data and the operations permitted on that data. The following types are supported by Touch Develop for the @boardname@:
* **[String](/reference/types/string)**: a sequence of characters
* **[Number](/reference/types/number)**: an integer number (32-bit signed)
* **[Boolean](/reference/types/boolean)**: true or false
* **[String](/types/string)**: a sequence of characters
* **[Number](/types/number)**: an integer number (32-bit signed)
* **[Boolean](/types/boolean)**: true or false
* **[Image](/reference/image/image)**: a collection of [@boardname@ LED states](/device/screen) (on/off)
* *more types coming!!!*

View File

@ -104,5 +104,5 @@ Use **global variables** when you need to access a variable in nested code block
### See also
[types](/reference/types), [assignment operator](/reference/variables/assign)
[types](/types), [assignment operator](/reference/variables/assign)

View File

@ -5,7 +5,7 @@ Repeat code in a loop while a condition is true.
### @parent javascript/language
Repeat code while a [Boolean](/reference/types/boolean) `condition` is true.
Repeat code while a [Boolean](/types/boolean) `condition` is true.
### ~hide
@ -26,7 +26,7 @@ while (condition) {
}
```
The while loop has a *condition* that evaluates to a [Boolean](/reference/types/boolean) value. After the `do` keyword, add the code that you want to run while the `condition` is `true`. The while loop concludes with `end while`.
The while loop has a *condition* that evaluates to a [Boolean](/types/boolean) value. After the `do` keyword, add the code that you want to run while the `condition` is `true`. The while loop concludes with `end while`.
The condition is tested before any code runs. Which means that if the condition is false, the code inside the loop doesn't execute. Use the [break statement](/js/break) to exit a while loop before it's complete.