{ }codelper

Learn with tiles › 29

Working with text

Measure the length of text, reverse it, and take out one character.

1

Text is a value made of characters in a row. Text: length tells you how many characters there are.

A text tile needs to know which text in its front slot. After you choose the tile, tap the front slot and change it to the variable word.

Write the length of the word from input.

To do Read a word from one line of input and make the number of characters appear. For Craykon it is 7.

Loading tiles…

2

Text: reverse gives back the text with its characters in reverse order. Text: (times) times over joins the same text several times.

Reverse the word from input and write it.

To do Write the word from input backwards. For abc it is cba.

Loading tiles…

3

text[(0)] takes out one character. Positions are counted from 0. The first character is number 0, and the second character is number 1.

Right now the first character appears. Change the position number so that the second character appears.

With what you have learned so far, you can also try the tile problems.

To do Make the second character of the word from input appear. For apple it is p.

Loading tiles…

Next: Making a list →