It’s much more complex. Part of your value as an engineer is having a good feel for balancing the trade offs on your code.
Code is usually a liability. A means to an end. But is your code going to run for a minute, a month, a year, or longer? How often will it change? How likely are you going to have to add unforeseen features? Etc. Etc. Etc.