From 0134e34e035a139677413acb20e42b4f7f490021 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 12 Oct 2020 23:24:30 -0700 Subject: [PATCH] dup docs: add an example with `addQuoted` (#15548) * dup docs: add addQuoted example * fixup --- lib/pure/sugar.nim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/pure/sugar.nim b/lib/pure/sugar.nim index be5e1f326b..92e9f662ad 100644 --- a/lib/pure/sugar.nim +++ b/lib/pure/sugar.nim @@ -244,6 +244,11 @@ since (1, 1): var c = "xyz" # 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" var d = dup c: makePalindrome # xyzyx