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:
pythonconst double x = 42;
The variable x
will always be 42 and nobody can change it. The following code would cause an error:
python912const int x = 10;x = 15;
You should declare variables as constants if you are sure that they will probably never change:
python912const int monthPerYear = 12;const char firstAlphabetLetter = 'A';
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 2. Capitolo 8
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione