From 90cd795b8bc22719e43183444d1963eda5161de6 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 19 Jan 2012 01:22:19 -0800 Subject: Update docs to reflect pattern syntax change --- doc/tutorial/data.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'doc/tutorial') diff --git a/doc/tutorial/data.md b/doc/tutorial/data.md index 600589d07b7..79a0cb85ac5 100644 --- a/doc/tutorial/data.md +++ b/doc/tutorial/data.md @@ -155,18 +155,16 @@ patterns, as in this definition of `area`: } } -For variants without arguments, you have to write `variantname.` (with -a dot at the end) to match them in a pattern. This to prevent -ambiguity between matching a variant name and binding a new variable. +Another example: # type point = {x: float, y: float}; # enum direction { north; east; south; west; } fn point_from_direction(dir: direction) -> point { alt dir { - north. { {x: 0f, y: 1f} } - east. { {x: 1f, y: 0f} } - south. { {x: 0f, y: -1f} } - west. { {x: -1f, y: 0f} } + north { {x: 0f, y: 1f} } + east { {x: 1f, y: 0f} } + south { {x: 0f, y: -1f} } + west { {x: -1f, y: 0f} } } } -- cgit 1.4.1-3-g733a5