Constants & Variables

Last updated

What is Constants & Variables?

In Ruby, variables are named storage locations that hold data, and their values can be changed during the program's execution. Constants, on the other hand, are also named storage locations, but their values are intended to remain fixed throughout the program's runtime. While Ruby technically allows you to reassign a constant (it will issue a warning), the convention is to treat them as immutable values that should not be altered. Variables are typically named using snake_case, while constants are named using SCREAMING_SNAKE_CASE.

Free resources to learn Constants & Variables

Constants & Variables: common questions

Can I learn Constants & Variables in Hindi?

This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Constants & Variables in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.

Is this Constants & Variables tutorial for beginners?

It is lesson 6 of 102 in the free Ruby roadmap, in stage 3, Constants & Variables. If you are new to Ruby, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.

Still confused? Ask me