From cf63aa0ee65a5f624378bff21d8d32f127662481 Mon Sep 17 00:00:00 2001 From: flaviut Date: Fri, 20 Jun 2014 12:02:01 -0400 Subject: [PATCH] Modify division --- content/numbers.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/content/numbers.md b/content/numbers.md index 3a8f61a..553d0ec 100644 --- a/content/numbers.md +++ b/content/numbers.md @@ -23,4 +23,14 @@ let Precedence rules are the same as most other languages, but instead of `^`, `&`, `|`, `>>`, `<<`, the `xor`, `and`, `or`, `shr`, `shl` operators are used, respectively. -Another difference that may be surprising is that the `/` operator returns a floating point result, even when the operands are integers. This means that `3/2` will return something like `0.33`. If integer division is needed, the `div` operator should be used. \ No newline at end of file +``` nimrod +let + a: int = 2 + b: int = 4 +echo 4/2 +``` +``` console +$ nimrod c -r numbers2.nim +2.0 +``` +Another difference that may be surprising is that the `/` operator returns a floating point result, even when the operands are integers. If integer division is needed, the `div` operator should be used. \ No newline at end of file