Questions tagged [enum]

A data type consisting of a set of named values called elements, members or enumerators of the type.

Filter by
Sorted by
Tagged with
2
votes
2answers
19 views

Can I write a function to edit an enum?

I have an enum with certain predefined data. If at a later date, I have to add or push in more choices , can I edit the enum using some function ? enum ActionChoices { GoLeft, GoRight, GoStraight, ...
0
votes
1answer
14 views

Pass enum value in mapping

I am trying to pass a default value in solidity but get the following error: "Invalid implicit conversion from enum tlb.Category to enum tlb.Category[] memory requested" Does anybody have an ...
0
votes
1answer
42 views

If I pass an enum as a parameter does it get stored in the blockchain?

I'm developing a Rock/Paper/Scissors Smart Contract (with a Commit-Reveal scheme). I have this enum: enum Move {rock, paper, scissors} I want to pass it to a function, without storing it to the ...
1
vote
0answers
28 views

Mapping shared between contracts

I have enums that I use in many contracts of one project. Sometimes, they need to be mapped to a uint256. Their uint256 values do not relate to their positions in the enum list, so I can't just cast ...
2
votes
1answer
179 views

What size is an enum member inside of a struct

Let's consider the following code: pragma solidity ^0.4.18; contract Test { enum EnumTest { Test0, Test1 } struct StructTest { EnumTest Foo; uint256 Bar; } } Not taking ...
1
vote
1answer
257 views

Possible to get enum length / count in solidity contract?

Is it possible to access the length of an enum in solidity? E.g. pragma solidity >=0.4.16 <0.6.0; contract test { enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } function ...