QforMortals3/Whitespace

From Kx Wiki
Jump to: navigation, search

1.3 Whitespace

In general, q permits, but does not require, whitespace around operators, separators, brackets, braces, etc. You could also write the above expression as

a : 42

or,

a: 42
Information.png Tip: Accomplished q programmers view whitespace around operators as training wheels on a bicycle.

Because the q gods prefer compact code, you will see programs with no superfluous whitespace...none, zilch, zip, nada. In order to help you get accustomed to this terseness, we use whitespace only in juxtaposition and after semicolon and comma separators. You should feel free to add whitespace for readability where it is permitted, but be consistent in its use or omission. We will point out where whitespace is required or forbidden.



Prev: Variables, Next: The_Q_Console

Reprinted with the author's permission from: q for Mortals Version 3, An Introduction to Q Programming by Jeffry A. Borror.

The book is available on Amazon. In the United Kingdom, it is available at Amazon UK.

©2015 Jeffry A. Borror/ q4m LLC

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox