1

I have to perform something like this:

uint r = a wei; 

Which displays an error, however:

uint r = 1 wei;

Doesn't throw an error.

How can I dynamically change the value of uint to wei in the contract itself?

2

How about:

uint a;
uint oneWei = 1 wei; // Or finney or...
uint r = a * oneWei;
  • No need for the variable. a * 1 wei should work – Tjaden Hess Sep 21 '16 at 2:20

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.