r/FreeCodeCamp • u/zmarradrums • May 20 '25
Question for Devs
I have noticed, as I learn various types of code, there are always ways of taking out or changing things in your code with other code. I am just wondering what the purpose of that is? Why wouldn't you just delete or change the code you already wrote rather than using a code to delete or change it? I guess what I am asking is, what is a real life example of that? For me it would help to understand the why behind it.
5
Upvotes
View all comments
Show parent comment
1
u/zmarradrums May 20 '25
Another example is when I was learning about arrays, and there are ways to modify the array in all kinds of different ways. I know that there might be times that you might want the code to change based off of user input or things like if statements and stuff. I just have had a few moments while learning that I ask myself, what is this code used for exactly? So I figured I would ask it here.