Cipherd@lemmy.ml to Programmer Humor@programming.dev · 1 day agofunctionsimagemessage-square112fedilinkarrow-up1597arrow-down18file-textcross-posted to: programmerhumor@lemmy.ml
arrow-up1589arrow-down1imagefunctionsCipherd@lemmy.ml to Programmer Humor@programming.dev · 1 day agomessage-square112fedilinkfile-textcross-posted to: programmerhumor@lemmy.ml
minus-squareSpaceCowboy@lemmy.calinkfedilinkarrow-up1arrow-down3·16 hours agoA constant inside a function is not constant to the computer. It’s only constant within the scope of the function. So it’s not constant to the computer since every time the function is called the “constant” will have a different value. Do you even know what a real constant is? You maybe need to rethink some things.
minus-squaremasterspace@lemmy.calinkfedilinkEnglisharrow-up1·10 hours agoThat variable is only created when the function is run, and it holds a constant value for the entirety of its lifetime. It is literally constant from the perspective of the computer executing it. You’re the one adding an extra layer of expectation here.
A constant inside a function is not constant to the computer. It’s only constant within the scope of the function. So it’s not constant to the computer since every time the function is called the “constant” will have a different value.
Do you even know what a real constant is?
You maybe need to rethink some things.
That variable is only created when the function is run, and it holds a constant value for the entirety of its lifetime.
It is literally constant from the perspective of the computer executing it. You’re the one adding an extra layer of expectation here.