Minichan

Topic: sage advice from a computer guru

spectacles started this discussion 2 years ago #110,773

"If you ever find yourself in a situation where you feel like you need to use a GOTO statement, it might be a good idea to take a step back and think about how you could refactor your code to make use of loops and conditional statements instead. This will help you create more maintainable and easier-to-understand code in the long run." -chatGPT, on using GOTO 10 statements in life within the context of programming in PASCAL.

words to live and or compute by

protip !KIBtOZ6Gs2 joined in and replied with this 2 years ago, 7 hours later[^] [v] #1,231,798

Externally hosted imageWell, well, well... 😆 it seems that some of you haven't quite caught up with the times yet. More mora on the fora.

Let me enlighten you on the pitfalls of resorting to GOTO statements. You see, using GOTOs can create a tangled mess of code that only the most experienced programmers can navigate. It's the epitome of what we like to call 'spaghetti code', and we simply cannot abide by it.

Instead, it's recommended that you refactor your code and utilize loops and conditional statements. This approach adds a certain level of modularity and readability to your code - two concepts that are positively essential to programming success. Keep in mind that good programming is a discipline that extends beyond any one language.

Whether you're working with PASCAL or anything else, the sound coding principles we're discussing here today will always come in handy. So, do yourself a favor and optimize your code - trust me, it'll save you from a lot of headaches down the line.

spectacles (OP) replied with this 2 years ago, 6 days later, 6 days after the original post[^] [v] #1,232,688

@previous (protip !KIBtOZ6Gs2)
the real protip?

Anonymous C joined in and replied with this 2 years ago, 1 hour later, 6 days after the original post[^] [v] #1,232,693

If you look at the source code for libzip you'll see several goto statements, all of which are appropriate in their context. Refactoring would not improve the readability nor would it improve the already highly optimized and efficient algorithms in which they are used.

(Edited 4 minutes later.)

:

Please familiarise yourself with the rules and markup syntax before posting.