String Expressions

We may also combine strings using some of the same operators. They do, however, take on a slightly different meaning when dealing with strings.

Concatenation (Joining Strings)

You can use the + operator to concatenate (join) strings together:

print "Hello" + ", world!"

If you concatenate a string with a number, the number is converted to a string automatically:

console

As we go further along, we will discuss additional string operations, such as finding characters inside a string, extracting string fragments, and so on. For now, all we need to know is how to print friendly messages to the console.

Exercise

Use numbers and string concatenation to print today's date to the console. Be sure to supply a label for your output value.

console

Back (011-expressions)
Forward (020-variables)