DEV Community

loading...

Discussion on: Learning Rust #2: Option & Result

Collapse
mojochao profile image
Allen Gooch

I think the phrase you're looking for instead of "dual type" is "sum type". Sum types are widely used in functional programming languages and are an example of an algebraic data type (ADT). The other common type of ADT is the "product type" which corresponds to structs in Rust.

Stick with it. This stuff didn't really click with me either until I started working with Elixir and OCaml. Thanks for sharing your experience!

Collapse
hamatti profile image
Juha-Matti Santala Author

Thanks, sum type is good to know, that helps me also study more on them!

Forem Open with the Forem app