From 7fdc860b6347461f929f81482715dc747e46865a Mon Sep 17 00:00:00 2001 From: Jiahao Chen Date: Mon, 27 Oct 2014 23:53:27 -0400 Subject: [PATCH] Simplify wording and rework example as doctest --- doc/manual/mathematical-operations.rst | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/doc/manual/mathematical-operations.rst b/doc/manual/mathematical-operations.rst index 2984a1df82030..3b6c307b1fb75 100644 --- a/doc/manual/mathematical-operations.rst +++ b/doc/manual/mathematical-operations.rst @@ -122,17 +122,21 @@ are:: += -= *= /= \= %= ^= &= |= $= >>>= >>= <<= -It should be noted that updating operators can change the type of the variable. For example, after the first -statement below, ``x`` is of type ``Uint32``, but after the second statement, it is of type ``Int``:: - - - x = 0x00000001 - x *= 2 - - -This is in consistent with the equivalence between ``x *= 2`` and ``x = x * 2``: any assignment statement to -a plain variable may change its type. - +.. note:: + Updating operators may change the type of the variable, since any assignment + statement to a plain variable may change its type. + + .. doctest:: + + julia> x = 0x01; typeof(x) + Uint8 + + julia> x *= 2 #Same as x = x * 2 + 2 + + julia> isa(x, Int) + true + .. _man-numeric-comparisons: Numeric Comparisons