KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Academy Scripting and logging question Reply To: Scripting and logging question

  • rocuinneagain

    Member
    August 27, 2024 at 2:49 pm

    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]