0
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

contract enumTesting{
    enum frenchFriesSize {large, medium, small}
    frenchFriesSize choice;
    frenchFriesSize constant defaultChoice = frenchFriesSize.medium;
    
    
    function setSmall() public {
        choice = frenchFriesSize.small;
    }
    
    function getChoice() public view returns(frenchFriesSize){
        return choice;
    }
    
    function getDefault() public view returns(uint){
        return uint(defaultChoice);
    }
    
}

Remix is sugesting me to change the getDefault function to "pure", but isn't reading the variable "defaultChoice" from outside of the function?

1 Answer 1

0

Remix recommends to declare the function as pure because defaultChoice isn't a variable. The compiler does inline constant in the code so they don't use space in storage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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