I’m used to sprinkling print statements to debug my code. How can I do the same in q?

Like printf, 0N! is your friend. When you place 0N! before an expression, it prints the result of that expression to the console and then returns it:

q)1 + 0N! til 10
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
q)

0N! does change the functionality of your code in one subtle, albeit usually harmless, way. If you place 0N! before a modifier-assignment operator (e.g. +:, -:), then the result of that assignment is no longer null; it is the value assigned:

q){x +: 47} 1
q){0N! x +: 47} 1
48
48
q)

See also: .Q.s and .Q.s1