Lesson 6: String concatenation
To join texts together you use the + sign. For example "Hello, " + name gives a greeting with the name inside it. Two important points: you must add spaces yourself ("Hi" + name sticks into HiDana), and when you join a number to a string, the number automatically becomes text ("Age: " + 30 gives Age
+ between strings is like glue: it sticks two texts into one. If you want a space between them — you must put it yourself inside the quotes.
- concatenation (+)
- Joining two or more strings into one, using +.
- manual space
- Concatenation adds no spaces — you must include them inside the quotes.
- number to string
- When + meets a string and a number, the number becomes text and is joined.