It's still useful when it's wrong because it can give you the jist of what should be done. If it uses a library or function that doesn't exist, you'll still be informed as to what it was intending for the process at that point. I've often gone and just replaced the made-up code with custom code that does the same thing.
It is nice to generate generalizable code examples, to give me clues how stuff works. I find that my work (marine biogeochemistry) is obscure enough that there's a certain level where I am still on my own. Which is a good sign for my future employability!