0

Why I can't division two variables with defirent type?

For example: func main() { a, b, c := arithmetic(2, 5, 8) println(a, b, c) } func arithmetic(x, y, z int) (int, int, float32) { sum := x + y multiplication := sum * z return sum, multiplication, z / multiplication } Here more detail: https://play.golang.org/p/KTsMA2rAiey

16th May 2021, 8:36 AM
Максим Орлов
Максим Орлов - avatar
1 Resposta
0
The code will of course run but the result will not be correct. With this approach I would get the following values: 7 56 0. 8 divided by 56 should not be 0. This is what I wanted to know how to do. Although I already did, here: https://play.golang.org/p/2_fW4mKV5D7
16th May 2021, 1:48 PM
Максим Орлов
Максим Орлов - avatar