q language operator precedence - Kdb+ / qStudio

Home Forums Kdb+ / qStudio q language operator precedence

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #162

    Bob
    Guest

    q)10*11+3
    140
    q)10*(11+3)
    140

    What is the order of precedence for the various operators in q?
    The answer above is different than in any other language I know.

    #170

    admin
    Keymaster

    q code is has no order of precedence, it is interpreted from right to left. e.g.

    q)3%2-100+10*neg 11+3
    0.07142857
    q)3 % (2- (100+ (10*(neg (11+3)))))
    0.07142857

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.