FAQ
i.e. the corresponding reflection functions for the following form:

v, ok := m[k]


reflect.MapIndex() returns zero value of the value type which is
corresponding to the single Lhs situation:

v := m[k]


Thanks!
David

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Julian Phillips at Mar 28, 2015 at 9:05 pm

    On 28/03/2015 20:42, David DENG wrote:
    i.e. the corresponding reflection functions for the following form:

    v, ok := m[k]


    reflect.MapIndex() returns zero value of the value type which is
    corresponding to the single Lhs situation:

    v := m[k]
    Actually, it doesn't. It returns "the zero Value", i.e. IsValid() will
    return false on the return if the entry was not found.
    e.g. http://play.golang.org/p/tauw5SRvvJ

    --
    Julian

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • David DENG at Mar 29, 2015 at 3:17 am
    Thanks, this helps!
    On Saturday, March 28, 2015 at 2:06:01 PM UTC-7, Julian Phillips wrote:
    On 28/03/2015 20:42, David DENG wrote:
    i.e. the corresponding reflection functions for the following form:

    v, ok := m[k]


    reflect.MapIndex() returns zero value of the value type which is
    corresponding to the single Lhs situation:

    v := m[k]
    Actually, it doesn't. It returns "the zero Value", i.e. IsValid() will
    return false on the return if the entry was not found.
    e.g. http://play.golang.org/p/tauw5SRvvJ

    --
    Julian
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 28, '15 at 8:42p
activeMar 29, '15 at 3:17a
posts3
users2
websitegolang.org

2 users in discussion

David DENG: 2 posts Julian Phillips: 1 post

People

Translate

site design / logo © 2022 Grokbase