loading...
markdown guide
 

@nestedsoftware gave a solid answer about what an enum type is, but "enumeration" just means to make a list of things in sequence, or count them. You could enumerate a list - for instance, in Rust:

['a','b','c'].iter().enumerate();

This gives back an iterator that would look like this when collected:

[(0, 'a'), (1, 'b'), (2, 'c')]

The elements in this list have been "enumerated", or counted.

 

Thank you, now it’s making sense to me.

 

Are you referring to an ‘enum’ type? If so, it’s a type that allows you to define a finite sequence of named values for that type. Here’s an example from typescript:

enum Cardsuit {
    Clubs, 
    Diamonds, 
    Hearts, 
    Spades
};

var c: Cardsuit = Cardsuit.Diamonds;

Not all languages have enums. You can read more about it on Wikipedia: en.m.wikipedia.org/wiki/Enumerated...

 
Classic DEV Post from Dec 7 '19

To memorize or not to memorize?

What is actually worth memorizing for software engineers?

Mahfuz Shaikh profile image

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️