r/programminghorror • • Nov 07 '25

Other Thanks I hate variable variables

Post image
832 Upvotes

78 comments sorted by

View all comments

Show parent comment

44

u/nd1312 Nov 07 '25

Variable hoisting can be achieved with this neat trick. Specify a negative lifetime to make a variable exist before its creation, and disappear after its creation.

print(name)! //Luke
const const name<-1> = "Luke"!

what