2016-03-26 00:47:20 +01:00
# String
2016-04-02 01:22:47 +02:00
a piece of text.
2016-03-26 00:47:20 +01:00
### @parent blocks/language
2016-04-13 17:27:45 +02:00
A *String* is a sequence of characters. For the BBC micro:bit, ASCII character codes 32 to 126 are supported; letters, digits, punctuation marks, and a few symbols. All other character codes appear as a ? on the [LED screen ](/device/screen ).
2016-03-26 00:47:20 +01:00
2016-06-14 23:20:45 +02:00
### Create a string variable
2016-03-26 00:47:20 +01:00
2016-06-14 23:20:45 +02:00
```block
2016-07-19 12:26:41 +02:00
let salutation = "Hello";
2016-06-14 23:20:45 +02:00
```
2016-03-26 00:47:20 +01:00
2016-06-14 23:20:45 +02:00
To create a variable that holds a string:
2016-03-26 00:47:20 +01:00
2016-07-19 10:25:48 +02:00
1. Click `Variables` (in the Block drawer).
2016-03-26 00:47:20 +01:00
2. Type a name for your new string variable by clicking the down arrow, then click New Variable. Then type the variable name "salutation"
2. Drag a string block on the right side of the operator.
3. Click `"Hello"` and then type a string like `hello` .
Your code should look something like this:
2016-06-14 23:20:45 +02:00
```block
2016-07-19 12:26:41 +02:00
let salutation = "Hello";
2016-06-14 23:20:45 +02:00
```
2016-03-26 00:47:20 +01:00
### The function `show string`
2016-06-14 23:20:45 +02:00
Use [show string ](/reference/basic/show-string ) to display a string on the [LED screen ](/device/screen ).
If the string is multiple characters, the string scrolls right to left. The following example displays `Hello world!` on the micro:bit screen:
2016-03-26 00:47:20 +01:00
2016-06-14 23:20:45 +02:00
```block
basic.showString("Hello world!");
```
2016-03-26 00:47:20 +01:00
The parameter of `show string` specifies the string
### See also
2016-06-14 23:20:45 +02:00
[string functions ](/reference/types/string-functions ), [Number ](/reference/types/number ), [show string ](/reference/basic/show-string )
2016-03-26 00:47:20 +01:00