Thanks. Why is the plus operator defined on myInt? Or if it simply treats a myInt as an int, why isn't the result an int?
Sorry if this is a stupid question; I think either there is something deeper to this or else the arithmetic operators just have a special processing for this case. On Sunday, February 18, 2018 at 2:16:17 PM UTC-5, Jan Mercl wrote: > > On Sun, Feb 18, 2018 at 8:06 PM Bill Wood <wpwo...@gmail.com <javascript:>> > wrote: > > > I thought that the plus operator would return an int, not a myInt. > > expr1 + expr2 works iff types of expr1 and expr2 are the same and the > result has the same type as both of the operands. Analogically for the > subtraction, multiplication and division operations. > > -- > > -j > -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.