Slide 3
Slide 3 text
Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 3
+ operator
• If two operands of + are numbers, it performs an
arithmetic addition.
• If at least one of operands of + is a string, it performs
a string concatenation.
• Examples:
o 2 + 3 will be 5
o 2 + “ apples” will be “2 apples”
o “number ” + 5 will be “number 5”
o “we have “ + 2 + 3 will be “we have 23”
o “we have “ + (2 + 3) will be “we have 5”