how to program
HOW TO PROGRAM . IT - learn how to program - online interactive programming tutorial and programming course
Adding Strings

Lesson 06: Strings can be added together by using the plus + operator...

Program Code:

Anywhere a string can be used, like in an output statement such as env.out, we can also use an expression which equates to a string. The expression in this case is "Hello" + " World" which equates to the string "Hello World".

This may not seem useful yet, but it will be useful once you learn about variables in subsequent lessons.

Not every programming language has an easy way of adding strings, sometimes concatenate functions need to be used instead. With PHP, the operator for adding strings is a full stop . rather than a plus +. Languages such as VB (Visual Basic) or VBScript use an ampersand & instead of a plus +.


1. Take the space out of the World string.
2. Add the space to the end of the Hello string.
3. Add a third string " and Hello Everybody".

To return to previous page click here

by running the tutorial programs on this site, you are agreeing to our terms and conditions (please check these first).
Wed 19 Jun 2019 web design | login © 2019 Abstract Worlds Ltd