Define operator - inline function

Category:
Defining Operator
Description: Define operator using inline function
Code:
let DefineOperator() =
let inline (++) x y = x+y*2
let a = 9
let r = (a++4)
printfn "%d" r
Assert.AreEqual(r, 17)

Execution Result:
17
both elements are equal

Last edited Sep 14, 2011 at 3:00 AM by ttliu2000, version 1

Comments

No comments yet.