There was an error while loading. Please reload this page.
The __divide__ function can be defined to allow additional types to be used with the divide / operator.
__divide__
/
func __divide__(a $A, b $B) $C { }
where $A, $B and $C are any valid types
$A
$B
$C
import basics struct DivisionIsAlwaysFive () func __divide__(_unused_a, _unused_b DivisionIsAlwaysFive) int { return 5 } func main { x DivisionIsAlwaysFive printf("x / x = %d\n", x / x) }
x / x = 5
Table of Contents