Scripting and logging question

https://learninghub.kx.com/forums/topic/scripting-and-logging-question

Hi,


I am working on module 08 scripting and logging and I'm a bit confused on the following example in the image.


I don't understand why we need to use the stdout function "out" to display the results of the list multiplication? I thought if we used the multivalent trap ".", it would display the results of the multiplication if no errors were found. But I tried running it without the out function and it wouldn't display the results and I'm confused as to why.


Any help would be appreciated,


Thank you!

If a line ends in ; then the output is not displayed.

$ cat test.q
a:til 10
f:{x*y}
f[a;5]; /Not displayed
f[a;200] /Displayed
f[a;.01]; /Not displayed
$ q test.q
0 200 400 600 800 1000 1200 1400 1600 1800
q)

Note that -1 will display items differently than letting q display them

$ cat test.q
a:til 10
f:{"the answer is "," "sv string x*y}
f[a;200] //Result will print but include "" around it
f2:{-1 "the answer is "," "sv string x*y}
f2[a;200] //Result printed to standard out does not display "". -1 is also shown as the returned value.
f2[a;200]; // Same as above but ; suppresses -1 bring shown
f3:{-1 "the answer is "," "sv string x*y;}
f3[a;200] //; moved inside the function to supress -1
$q test.q
"the answer is 0 200 400 600 800 1000 1200 1400 1600 1800" //f[a;200]
the answer is 0 200 400 600 800 1000 1200 1400 1600 1800 //f2[a;200]
-1 //f2[a;200] continued
the answer is 0 200 400 600 800 1000 1200 1400 1600 1800 //f2[a;200];
the answer is 0 200 400 600 800 1000 1200 1400 1600 1800 //f3[a;200]

Completely forgot it does that. It's working now, thank you.

q)reply:"\360\237\221\215"
q)reply
"\360\237\221\215"
q)-1 reply;
?