+
The plus sign ( + ) has three meanings.
1. It is the addition operator when used between numeric variables or constants.
Example
counter = 0; lines = 0;
counter = counter + lines; #Add lines to counter
2. It is the concatenation operator when used between two string variables or constants. Concatenation appends a second string value to the first.
Example
title = "Summary Report for " + date + " -- Page " pagno;
# Construct the title
3. It is a metacharacter that is used in regular expressions. It matches one or more of the character it follows. It can follow a regular expression that evaluates to a character.
Example
/ab+/ will match abbbbbbbb or ab or abb
/a[x-z]+/ will match ax or axxx or ayyy or azz or ay.
Last modified date: 12/03/2024