in "_ = debug && mylog.Infof("%s %d", str, n)", will the mylog.Infof call be always not executed if variable debug is false?

62 views
Skip to first unread message

tapi...@gmail.com

unread,
Oct 8, 2020, 10:58:48 AM10/8/20
to golang-nuts

.

tapi...@gmail.com

unread,
Oct 8, 2020, 11:39:22 AM10/8/20
to golang-nuts
It looks the answer should be yes, as Go spec says:

   Logical operators apply to boolean values and yield a result of the same type as the operands. The right operand is evaluated conditionally.

Is my understanding right?



On Thursday, October 8, 2020 at 10:58:48 AM UTC-4 tapi...@gmail.com wrote:

.

Jan Mercl

unread,
Oct 8, 2020, 1:21:36 PM10/8/20
to tapi...@gmail.com, golang-nuts


On Thu, Oct 8, 2020, 17:40 tapi...@gmail.com <tapi...@gmail.com> wrote:
It looks the answer should be yes, as Go spec says:

   Logical operators apply to boolean values and yield a result of the same type as the operands. The right operand is evaluated conditionally.

Is my understanding right?

Yes.





On Thursday, October 8, 2020 at 10:58:48 AM UTC-4 tapi...@gmail.com wrote:

.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8d564e38-250c-4a31-a706-7be82f6ac61cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages