KX Community

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

Home Forums KX Academy greater than or less than ?

  • greater than or less than ?

    Posted by lestat-jin on March 13, 2024 at 10:30 pm

    In the sample code below:

    upd:{

    .debug.x:x;

    apprequests upsert x;</p><p> numrequests[xvendor]+:1;

    if[BBB = xvendor;

    if[-74.9>xlat</p><p> 0N!"A trip for BBB has arrived at the long of ",string xlong

    ]

    ];

    }

    and note saying Using the

    upd function above, we can create an alert. Let’s say we want to publish an alert if the vendor is for BBB and the latitude is greater than -74.9 so we can inform the driver of their next trip:

    so -74.9>x`lat means lat value greater than? I’m confused here…

    lestat-jin replied 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • mwoods

    Administrator
    March 19, 2024 at 12:10 pm

    Hi @lestat-jin thanks for flagging this.

    Upon review I agree it is confusing and badly worded, in fact there are a number of small changes I have made to make to make this example clearer including:

    • changing the direction from > to <
    • asking for longitude rather than latitude as this is what we are outputting to console with 0N! so we can better see if it is meeting the checks
    • adding a missing semicolon at then end of the second if statement

    I have attached the updated example with fixes above.

    If you want to get the notebook with these changes you can delete your current directory from the terminal and relaunch the sandbox from the course.

    Thanks for your feedback and helping us to improve the materials !

    • lestat-jin

      Member
      March 24, 2024 at 7:17 pm

      Thanks!

Log in to reply.