6

I noticed this code in open zepplins contract:

  uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));

I've never seen the double ** before. What does it mean?

  • FYI, the same syntax for exponentiation is used in many programming languages: Python, Ruby, Perl, Fortran, ADA, OCaml, ... – Federico Poloni May 7 '18 at 10:19
12

from the solidity documentation :

Arithmetic operators: +, -, unary -, unary +, *, /, % (remainder), ** (exponentiation)


so : a**b is a to the power of b (i.e: a*a*a*...*a b times)

5

** is ^. 2 ** 3 equals 8( ´ ▽ ` )

0

This operator is used for exponentiation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.