I have heard really good things about the keyboards for the iPads. I’m still using an iPad Air 2 with a Logitech Bluetooth keyboard which works wonders.
There are code editing apps for iOS, but I don’t know what they're capable of these days. Some use cloud servers, but as soon as you know you want the option then the laptop is probably the way to go. Happy hunting!