Alim Hasanov
Alim Hasanov

Reputation: 197

q/kdb: How do I break my code into lines. Is there a new line 'escape' character or something similar?

I am writing long scripts on one line. I would like to organise my code by breaking code onto multiple lines without having to write a function. How do I do this?

Upvotes: 1

Views: 3281

Answers (1)

Gilmer
Gilmer

Reputation: 420

You can separate code over multiple lines as long as you indent each subsequent line. You should use semi colons to separate expressions which are indented.

For example a simple select statement split over multiple lines could look like this;

t:([]a:1 2 3;b:`a`b`c);

res:select
    from t
    where a<>1,
    b in `a`c;


show res

More information can be found here;

http://code.kx.com/q/tutorials/startingq/language/#29-scripts

Upvotes: 5

Related Questions