Ok, thank you for your response. Marc
Le jeudi 31 octobre 2019 19:07:34 UTC+1, alanfo a écrit : > > This in fact is correct behavior. > > As 100 is an untyped integer constant, 1e2 can not be implicitly converted > to the same type and so the % operation fails. > > You can fix it with: > > func main() { println(int(100) % 1e2) } > > Now 1e2 is converted to 'int' and all is well :) > > Alan > > On Thursday, October 31, 2019 at 5:13:48 PM UTC, Marc Vertes wrote: >> >> Hello, >> >> I see that the following code >> >> func main() { println(100 % 1e2) } >> >> is rejected by the compiler with "invalid operation: operator % not >> defined on untyped float" >> >> but the following >> >> func main() { i := 100; println(i % 1e2) } >> >> is happily accepted. Should I open an issue on this ? What should the >> normal behaviour be ? >> >> Thanks! >> > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/b450a394-0fb1-4fe5-b0f0-32d601424aab%40googlegroups.com.