Constant Variables | Python vs. JavaScript | Coding Class with The Code Doctor

Publié le: 18 juillet 2019
sur la chaîne: Python Fu Masters
29
1

#pythonfumasters #masterhun #python

What are constant variables?

Constant variables are variables with values that do not change during the program's run-time.

For example, PI (about 3.14) is a universal constant. It never, ever changes.

However, constant variables in Python are only constant variables in name only. Python doesn't have the ability to create constant variables. It's up to the coders to not code code that accidentally or intentionally make changes to the constant variables.

Usually, constant variables in Python have identifiers in all CAPS.

For example,

PI = 3.14
But if you code PI = PI + 5
Python will not throw up an error message.

If you code in JavaScript, you know you can code constant variables with the const keyword.

If you code

const x = 5;
// If you code x = x + 3;
// The JavaScript engine will throw up and error.


Web PythonFuMasters.com
Facebook @pythonfumasters
Instagram @masterhun
Podcast anchor.fm/pythonfumasters


Sur cette page du site, vous pouvez voir la vidéo en ligne Constant Variables | Python vs. JavaScript | Coding Class with The Code Doctor durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Python Fu Masters 18 juillet 2019, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 29 fois et il a aimé 1 téléspectateurs. Bon visionnage!