dup docs: add an example with addQuoted (#15548)

* dup docs: add addQuoted example

* fixup
This commit is contained in:
Timothee Cour 2020-10-12 23:24:30 -07:00 • committed by GitHub
commit 0134e34e03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -244,6 +244,11 @@ since (1, 1):
var c = "xyz" var c = "xyz"
# An underscore (_) can be used to denote the place of the argument you're passing: # An underscore (_) can be used to denote the place of the argument you're passing:
doAssert "".dup(addQuoted(_, "foo")) == "\"foo\""
# but `_` is optional here since the substitution is in 1st position:
doAssert "".dup(addQuoted("foo")) == "\"foo\""
# chaining:
# b = "xyz" # b = "xyz"
var d = dup c: var d = dup c:
makePalindrome # xyzyx makePalindrome # xyzyx