[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why does #{nil, "sun"} output 2, whereas a={}; a[2]="sun"; print(#a) output 0?
- From: Robert Burke <sharpobject@...>
- Date: Mon, 12 Oct 2020 17:22:53 +0900
On Mon, Oct 12, 2020 at 3:48 PM 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
>
> Sorry, hit send too early. Was going to say here:
> > a[1] == b[1] --output: true
> > a[2] == b[2] --output: true
> > a == b --output: false amazing!!!
> It's amazing that both "a[1]==b[1]" and "a[2]==b[2]" return "true" whereas
> "a==b" returns "false".
>
> Best regards
> Sunshilong
For tables, == will just tell you whether a and b are the same table,
not whether they have equal contents. That's like python's "is",
Java's "==", and JavaScript's "===".