[Domino] Integer division operator
I often use code such as the following to simply divide two integers and get the result as an integer, throwing away any remainder:
…
dim x as integer, y as integer, res as integer
x = 11
y =4
res = Fix (x / y)
…
The above code would return 2 in the integer variable res.
Of course, if I had used res = x/y, res would have the value of 3, since LotusScript will implicitly round any float when converting to an integer.
Simple, right? But there actually is an operand for performing exactly this type of “integer division”. You can use the backslash character ( \ ), as in:
…
res = x \ y
…
The backslash operand has been there forever (well, at least back to R5), but how rarely I see it used.
Entry filed under: domino. Tags: domino, LotusScript.
Trackback this post