From 8c38dfd537eba8947d2397b9e3f4a56bdb0647fe Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 30 Apr 2015 13:55:03 -0400 Subject: Describe (a,) vs (a) in docs Fixes #24730 --- src/doc/trpl/primitive-types.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/doc/trpl') diff --git a/src/doc/trpl/primitive-types.md b/src/doc/trpl/primitive-types.md index aca6e327c3b..e017e222c74 100644 --- a/src/doc/trpl/primitive-types.md +++ b/src/doc/trpl/primitive-types.md @@ -248,6 +248,14 @@ or “breaks up” the tuple, and assigns the bits to three bindings. This pattern is very powerful, and we’ll see it repeated more later. +You can disambiguate a single-element tuple from a value in parentheses with a +comma: + +``` +(0,); // single-element tuple +(0); // zero in parentheses +``` + ## Tuple Indexing You can also access fields of a tuple with indexing syntax: -- cgit 1.4.1-3-g733a5