message after print to stderror not shown

https://learninghub.kx.com/forums/topic/message-after-print-to-stderror-not-shown


in the below function, if we remove "show" then the date won't be displayed--my guess is it is due to the .z.D expression is after the -2 print? I guess we could leave the .z.D outside IF which guarantees the display, just wondering in general if any result after -2 print will not get shown, unless itself is part of -2 print ?


checkIfThresholdBreached: {[num] if[num>=0.9;-2"Warning! Threshold breached. Level is above 90%"; show .z.D ]}

checkIfThresholdBreached[1.89]


Thank you,

If statements in q do not return data.

https://code.kx.com/q/ref/if/


"The result of if is always the generic null."

q)result:if[1b;1]

q)result


q).Q.s1 result //The generic null is returned

"::"


//You can include the date in the printed output:

q){if[x>1;-2"Warn ",string[x]," above threshold 1 ",string .z.D]} 2

Warn 2 above threshold 1 2024.04.22

understood, thanks!