A Discussion of Tuple Syntax

bearophile bearophileHUGS at lycos.com
Tue Aug 20 08:18:45 PDT 2013


>>>> s = "red blue"
>>>> (a, b) = s.split()
>>>> a
> 'red'
>>>> b
> 'blue'

It's supported in Haskell too:

Prelude> let s = "red blue"
Prelude> let [a, b] = words s
Prelude> a
"red"
Prelude> b
"blue"

Bye,
bearophile


More information about the Digitalmars-d mailing list