fix: precedence and assignment operator questions #2
This commit is contained in:
parent
320bb1c177
commit
82ddaadee3
@ -29,5 +29,9 @@ func main() {
|
||||
fmt.Println(10 / 2 * (10 % 7))
|
||||
|
||||
// 100 / 5 / 2
|
||||
fmt.Println(100 / (5 / 2))
|
||||
// 5 / 2 = 2
|
||||
// 5 and 2 are integers, so, the fractional part drops
|
||||
// 5. / 2 = 2.5
|
||||
// because 5. is a float, so the result becomes a float
|
||||
fmt.Println(100 / (5. / 2))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user