0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Solidity】(tips)大きい数字を見やすくする方法

Posted at

大きい数字を見やすくする方法に関して下記します。
1 etherが10の18乗weiということもあり、solidity内でwei表記で大きい数字を扱うことがあります。
そんな"_"をつけると見やすくなリます。

RemixIDEで確認するとnumber2も"1000000000000000000"と表記されます。
"_"は数字に影響することなく、見やすくなります。

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract Sample{
    uint public number1 = 1000000000000000000;
    uint public number2 = 1_000_000_000_000_000_000;
}

※RemixIDEにより動作確認

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?