This error is caused when a branch like an if condition, $ if-else condition, while, do etc. has too many statements in it. If you receive this error you should modularise your code into more functions, both to fix the error and to make your code more readable. (See our guide on q coding standards)

We have written a kdb style guide that contains advice around naming, passing arguments and spacing that you may also find useful.