On Fri, Aug 19, 2016 at 12:54 PM, Rob Thornton <rthornton...@gmail.com> wrote:
> What is the purpose of the unary '+' operator? In both C and Go they are 
> syntactically correct but neither generate instructions to modify the 
> expression.

This is not an entirely serious answer, but the unary plus operator
permits columns of numbers to look nicer after gofmt.

var a = []int{
    +1,
    -2,
    +3,
    -4,
}

The same is true of leading zeroes, which also do not affect the value
of the expression.

Ian

-- 
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.

Reply via email to