From 3d99e8279575c686bd48801c3c3bad2fde8a30c6 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 18 Apr 2017 16:53:13 +0100 Subject: Add types to the examples --- docs/julia.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'docs') diff --git a/docs/julia.rst b/docs/julia.rst index f1a6d8f8..42c8047e 100644 --- a/docs/julia.rst +++ b/docs/julia.rst @@ -30,16 +30,16 @@ and ``mod`` are available either natively or as functions and computes exponenti .. code:: { - function power(base, exponent) -> (result) + function power(base:u256, exponent:u256) -> (result:u256) { switch exponent - 0: { result := 1 } - 1: { result := base } + 0:u256: { result := 1:u256 } + 1:u256: { result := base } default: { - result := power(mul(base, base), div(exponent, 2)) - switch mod(exponent, 2) - 1: { result := mul(base, result) } + result := power(mul(base, base), div(exponent, 2:u256)) + switch mod(exponent, 2:u256) + 1:u256: { result := mul(base, result) } } } } @@ -51,10 +51,10 @@ and ``add`` to be available. .. code:: { - function power(base, exponent) -> (result) + function power(base:u256, exponent:u256) -> (result:u256) { - result := 1 - for { let i := 0 } lt(i, exponent) { i := add(i, 1) } + result := 1:u256 + for { let i := 0:u256 } lt(i, exponent) { i := add(i, 1:u256) } { result := mul(result, base) } -- cgit v1.2.3