Skip to content

Commit

Permalink
Add a short discussion of string concatenation to the FAQ.
Browse files Browse the repository at this point in the history
Rationale: even though JuliaLang#11030
was closed, there is discussion of the issue from time to time on
Github and the forum; so if any question is frequently asked, this is.
  • Loading branch information
tpapp committed Nov 6, 2017
1 parent 2298cc2 commit 4c971b7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/src/manual/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,12 @@ julia> remotecall_fetch(anon_bar, 2)
1
```

### Why does Julia use "*" for string concatenation? Why not "+" or something else?

The main argument against `+` is that string concatenation is not commutative, while `+` is generally used as a commutative operator. While the Julia community recognizes that other languages use different operators and `*` may be unfamiliar for some users, syntax choices always have a subjective element and further discussions about this operator have not turned out to be productive, so it is not likely to change in the short run.

Note that you can also use `string(...)` to concatenate strings (and other values converted to strings); similarly, `repeat` can be used instead of `^` to repeat strings. The [interpolation syntax](@ref string-interpolation) is also useful for constructing strings.

## Packages and Modules

### What is the difference between "using" and "import"?
Expand Down

0 comments on commit 4c971b7

Please sign in to comment.