[nem-en] small detail about indent based syntax

Philippe Quesnel philippe.quesnel at gmail.com
Mon Nov 7 01:57:36 CET 2005


"heads-up" for the guys using the indent based syntax:

if you use the 'fallthrough' trick in a match,
to match multiple cases to one result :

match (s) {
 | "a"
 | "aa" => 1
 | "b"
 | "bb" => 2
 | _ => 0
}

in indent syntax :

match (s)
 | "a"
 | "aa" => 1
 | "b"
 | "bb" => 2
 | _ => 0

it won't work, you need to use line continuation ('\')

match (s)
 | "a" \
 | "aa" => 1
 | "b" \
 | "bb" => 2
 | _ => 0

or just use std syntax w. { .. } for this specific match:

def i = match (s) {
 | "a"
 | "aa" => 1
 | "b"
 | "bb" => 2
 | _ => 0
}


hope this helps someone,
thought I'd share the finding ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/pipermail/devel-en/attachments/20051107/d89255d3/attachment.html


More information about the devel-en mailing list