Skip to content

Commit

Permalink
Simplify wording and rework example as doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahao committed Oct 28, 2014
1 parent e244107 commit 7fdc860
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions doc/manual/mathematical-operations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7fdc860

Please sign in to comment.