onelang / OneLang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go: bitwise complement operator is ^, not ~

dolmen opened this issue · comments

The following code:

var x = 3;
x = ~x;

must be translated to Go as:

x := 3;
x = ^x;  // Not ~x

See https://play.golang.org/p/CbJQ-gPguyG