+ 2

Why a constant is called constant "variable"

its wrong please correct it

8th Nov 2017, 3:52 AM
amrith h namboodiri
amrith h namboodiri - avatar
6 ответов
+ 14
You can change/redefine a constant in Ruby though. You'll just get a warning to notify you about it.
8th Nov 2017, 5:38 AM
Hatsy Rei
Hatsy Rei - avatar
+ 12
Constants are variables that can't be changed.
8th Nov 2017, 4:00 AM
qwerty
qwerty - avatar
+ 10
constant variables are variables though. They just can not be changed once they are set but you can set them to anything. Thus they are a constant variable. const x = 5 is a constant variable opposed to say the number 5, which is a literal constant.
8th Nov 2017, 4:00 AM
jay
jay - avatar
+ 5
@Pegasus: Only if you attempt to change them during runtime. Changing the value before runtime is perfectly valid.
8th Nov 2017, 4:24 AM
jay
jay - avatar
+ 4
Altering then might return an error too
8th Nov 2017, 4:17 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
@jay thanks
8th Nov 2017, 4:02 AM
amrith h namboodiri
amrith h namboodiri - avatar