ZILtoid1991@lemmy.world to Programmer Humor@programming.devEnglish · 6 months agoFunctional bros be likelemmy.worldimagemessage-square27fedilinkarrow-up1157arrow-down113
arrow-up1144arrow-down1imageFunctional bros be likelemmy.worldZILtoid1991@lemmy.world to Programmer Humor@programming.devEnglish · 6 months agomessage-square27fedilink
minus-squareRageAgainstTheRich@lemmy.worldlinkfedilinkarrow-up0·6 months agoLegit question because i think I’m misunderstanding. But if its a const, how are you able to swap or replace it?
minus-squarefrezik@midwest.sociallinkfedilinkarrow-up1·6 months agoIt’s only a const within a function. You can pass the value to another function and changing it as it’s passed. For example: const int foo = 1 other_func( foo + 1) In functional programming, you tend to keep track of state on the stack like this.
minus-squareRageAgainstTheRich@lemmy.worldlinkfedilinkarrow-up1·6 months agoAaah okay i get it now :) that makes a lot more sense.
Legit question because i think I’m misunderstanding. But if its a const, how are you able to swap or replace it?
It’s only a const within a function. You can pass the value to another function and changing it as it’s passed. For example:
In functional programming, you tend to keep track of state on the stack like this.
Aaah okay i get it now :) that makes a lot more sense.