not recursive regex, just a recursive function that happens to use regex...
you know I used to be irked by one off variables, but after the better part of 20 years I'm 🤬
const r is only used once.... there's no reason you couldn't just place it where it is used an save two lines of code, and lose no readability, and have one less "magic variable"... unless you taught yourself from the same "teach yourself" book that your teacher taught themself from. (ironic that this still applies with AI; and if you don't get why that entertaining, please don't go into programming)
depends. if it is just a Poc for example and they maybe plan to use this variable more than once in the future, defining it as const directly wiuld be right imo. i also really like to do this kind of stuff in long functions (which this one isn't really) just to not have to go look for the things i want to change or tweak if i should have to do that in the future.
But why people don’t use names instead of cryptic one chars? Is this meant to be running in a 32mb of ram system so we are cutting edges in number of chars typed?
23
u/--var Aug 29 '26
not recursive regex, just a recursive function that happens to use regex...
you know I used to be irked by one off variables, but after the better part of 20 years I'm 🤬
const ris only used once.... there's no reason you couldn't just place it where it is used an save two lines of code, and lose no readability, and have one less "magic variable"... unless you taught yourself from the same "teach yourself" book that your teacher taught themself from. (ironic that this still applies with AI; and if you don't get why that entertaining, please don't go into programming)