mirror of https://github.com/rust-lang/rustlings
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ec2d4bd3ee | 5 years ago | |
---|---|---|
.. | ||
README.md | 5 years ago | |
enums1.rs | 5 years ago | |
enums2.rs | 5 years ago | |
enums3.rs | 5 years ago |
README.md
Enums
Rust allows you to define a type called enums
which allow you to enumerate possible values. In combination with enums, we have the concept of pattern matching
in Rust, which makes it easy to run different code for different values of an enumeration. Enums, while available in many languages, Rust's enums are most similar to algebraic data types
in functional languages, such as F#, OCaml, and Haskell.