KX Community

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

Home Forums KX Academy Function of syntax ` Re: Function of syntax `

  • Laura

    Administrator
    January 24, 2022 at 12:00 am

    example #1

    • b defined globally as 6
    • b defined locally as 42 using colon :
    • b defined globally as x (98) using set
    • local b returned as 42
    • global b returned as 98

    example #2

    • b defined globally as 6
    • b defined locally as 42 using colon :
    • nothing is happening as set without backtick does not do assignment
    • local b returned as 42
    • global b returned as 6

     

    So the reason for this behavior has more to do with function scoping than backtick. You can learn more about function scoping (defining locally verses globally) here, specifically around 4.30mins you can see in action the two ways of defining variables globally – using set and double colon.

    Hope this helps!