[Domino] Integer division operator

February 8, 2010 at 7:25 pm

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.

Advertisement

Entry filed under: domino. Tags: , .

[SQL Server] Rename a SQL Server Database Domino: 8.5.1 XPages Bug in Document Data Source


Ed Schembor’s Blog

Adventure's of an application developer, living in the world of corporate IT.

Feeds

Categories


Follow

Get every new post delivered to your Inbox.