Skip to main content
Solidity Output Prediction Easy +10 XP

State Variable Visibility

Which visibility allows external access to this variable?

SolidityRead-only
contract MyToken {
  uint256 ___ totalSupply;
}

What is the output?

Show answer and explanation

Answer: public

public creates an automatic getter function, allowing anyone to read the variable from outside the contract.

Hint: Which makes it readable externally?

What this challenge tests

Output Prediction in Solidity: visibility, state-variables.

Related challenges