Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Constant | Variables
Introduction to C++ | Mobile-Friendly
course content

Contenuti del Corso

Introduction to C++ | Mobile-Friendly

Introduction to C++ | Mobile-Friendly

1. Basics
2. Variables
3. Conditional Statements
4. Loops
5. Intro to Arrays

book
Constant

If you have a static variable that never changes and you want that nobody overrides your variable, use the const keyword by declaration. It makes the variable unchangable (constsant).

For example:

python

The variable x will always be 42 and nobody can change it. The following code would cause an error:

python

You should declare variables as constants if you are sure that they will probably never change:

python
question-icon

Define the variable secondsPerMinute as the const variable:

;

Click or drag`n`drop items and fill in the blanks

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 8

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

course content

Contenuti del Corso

Introduction to C++ | Mobile-Friendly

Introduction to C++ | Mobile-Friendly

1. Basics
2. Variables
3. Conditional Statements
4. Loops
5. Intro to Arrays

book
Constant

If you have a static variable that never changes and you want that nobody overrides your variable, use the const keyword by declaration. It makes the variable unchangable (constsant).

For example:

python

The variable x will always be 42 and nobody can change it. The following code would cause an error:

python

You should declare variables as constants if you are sure that they will probably never change:

python
question-icon

Define the variable secondsPerMinute as the const variable:

;

Click or drag`n`drop items and fill in the blanks

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 8
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt