On the left, red switch with a 1 on top, a 0 on the bottom, and turned to the 1 position + on the right a coaxial selector with the input on the bottom, an A and B position of top, and the central nob set to the A position

💭 Mental model for Booleans vs Enumerates

In programming, Booleans and Enumerates are common data types to represent the concept of “choice”. When there are several things to choose from, the Enumerate is the only one to support it, so that’s clear. But what about when you have two things to choose from? There might be some confusion between both data types since either of them supports handling binary choices. The confusion arrises in particular when you want to add the choice of a new behaviour, on top of an existing one....

May 15, 2023 · 2 min · 352 words

💭 Scala Enumerations Summary

Comparison between different ways of doing enumerates, with scala.Enumeration, case object and Java’s Enum.

May 14, 2017 · 9 min · 1882 words