# concatenating strings just means combining strings together
# it is used to add one string to the end of another
# below are two exmaples of how concatenation can be used
# to output 'Hello World':
# example 1:
hello_world = "Hello" + " World"
print(hello_world)
>>> Hello World
# example 2:
hello = "Hello"
print(hello + " World")
>>> Hello World
first = "first words"
second = "second words"
third = first+second
print(third)
#create an empty string c
c=""
#read input strings and store them in a and b
read a b
#for loop to append a group of strings to the variable c.
for val in $a 'ipsum' $b 'sit amet' 10
do
c+="$val "
done
#The result is a string that consists of all the elements concatenated into a single string
echo "$c"
#Read inputs a and b and store string variables in them.
read a b
#append b to the string a
a+=$b
#Output the resulting string
echo $a
String firstName = "John ";
String lastName = "Doe";
System.out.println(firstName.concat(lastName));
let myPet = 'seahorse';console.log('My favorite animal is the ' + myPet + '.'); // My favorite animal is the seahorse.