perl6-language
[Top] [All Lists]

Re: Quick question: (...) vs [...]

To: "John M. Dlugosz" <dhcgnd702@sneakemail.com>
Subject: Re: Quick question: (...) vs [...]
From: Audrey Tang <audreyt@audreyt.org>
Date: Sat, 09 Aug 2008 19:01:09 +0800
Cc: perl6-language@perl.org
Delivered-to: mailing list perl6-all@perl.org
Delivered-to: perl6-all-poster@perl.org
Delivered-to: mailing list perl6-language@perl.org
Delivered-to: perl6-language@perl.org
In-reply-to: <18932-80751@sneakemail.com>
List-help: <mailto:perl6-all-help@perl.org>
List-id: <perl6-all.perl.org>
List-id: <perl6-language.perl.org>
List-post: <mailto:perl6-all@perl.org>
List-subscribe: <mailto:perl6-all-subscribe@perl.org>
List-unsubscribe: <mailto:perl6-all-unsubscribe@perl.org>
Mailing-list: contact perl6-all-help@perl.org; run by ezmlm
References: <18932-80751@sneakemail.com>
User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707)
John M. Dlugosz 提到:
What is the difference between (1,2,3) and [1,2,3] ?

One is a List and one is an Array; you cannot push into a list, but you can into an array.

my @a := (1,2,3);
my @b := [1,2,3];

@a.push(4); # fails
@b.push(4); # works

Cheers,
Audrey


<Prev in Thread] Current Thread [Next in Thread>