Concept Flow - String concatenation
Start
Define strings
Use + operator
Combine strings
Store or output result
End
This flow shows how two or more strings are combined step-by-step using the + operator in PowerShell.
$greeting = "Hello" $name = "Alice" $message = $greeting + ", " + $name + "!" Write-Output $message
| Step | Action | Expression Evaluated | Result | Output |
|---|---|---|---|---|
| 1 | Assign $greeting | "Hello" | Hello | |
| 2 | Assign $name | "Alice" | Alice | |
| 3 | Concatenate $greeting + ", " | "Hello" + ", " | Hello, | |
| 4 | Concatenate previous + $name | "Hello, " + "Alice" | Hello, Alice | |
| 5 | Concatenate previous + "!" | "Hello, Alice" + "!" | Hello, Alice! | |
| 6 | Assign $message | Result of step 5 | Hello, Alice! | |
| 7 | Write-Output $message | $message | Hello, Alice! | Hello, Alice! |
| Variable | Start | After Step 1 | After Step 2 | After Step 6 | Final |
|---|---|---|---|---|---|
| $greeting | undefined | Hello | Hello | Hello | Hello |
| $name | undefined | undefined | Alice | Alice | Alice |
| $message | undefined | undefined | undefined | Hello, Alice! | Hello, Alice! |
PowerShell string concatenation uses + to join strings. Assign strings to variables first. Use + between strings or variables to combine. Result is a new string with all parts joined. Output with Write-Output or similar. Example: $a + $b + "!"