btw most of the time ChatGPT gives completely wrong code, it's possible it'll get better with time but right now, from my experience, it's at best a decent tool that gives answers which you need to put a lot of effort into checking.