Values and expressions
Programming is the art of transforming and moving data. We want to receive information, maybe from the user typing on a keyboard, from an IoT sensor on the roof of your house, or even from an incoming network request sent to your server. Then, we want to interpret and understand that information, representing it in a structured way in our program. Finally, we want to process and transform it, applying algorithms and interfacing with external sources (things such as querying a database or creating a local file). Pretty much all computer programs follow this structure, and it's essential to understand that it's all about data.
Crystal has many primitive data types used to express values. For example, you can write integer numbers using digits, as in 34
. You can also store data in variables. They act as named containers to store values and can change at any time. To do so, simply write the name of the variable, followed by an equals symbol, and the...