TIP: Understanding KM Tokens

@tom and @ronald,

TL;DR: ==KM Tokens are like functions, which return a value==.
(see comparison with Excel functions at bottom of thread).

Discussion

I have to disagree with Tom. IMO, it is misleading to think of "Tokens" as variables, because the very word "variable" means something that can vary. Especially in the programming world, "variables" are programming objects that the programmer can set to some arbitrary value (within typing rules). As Tom then mentioned, the KM user can NOT set a KM Token to some arbitrary value.

IMO, ==KM "Tokens" are best thought of as "functions"==, which always return a value specific to that Token. Some KM Tokens even allow for parameters, just like classical functions. In KM, the name of the Token is the name of the function.

Definition of Function

Here's one clear definition of "function" in software:

A function is a group of instructions, also known as a named procedure, used by programming languages to return a single result or a set of results.

Excel Functions

Even better, I suspect that most of you are familiar with Excel (or other spreadsheet app). In Excel, the spreadsheet cells act like "variables", and you can call any of the built-in functions that Excel provides:

Excel functions are designed to provide one word access to a series of operations. There are several dozen functions and they are organized according to their purposes. For example, in the excel formula " =SUM(A1:A10) ," a function that adds all the numbers in the range of cells specified in the formula.

So, Excels function SUM(A1:A2)
works in much the same way as
KM's Token %Calculate%myVarA1 + myVarA2%

I hope this helps. If anyone has questions about this, please feel free to ask.

3 Likes

Point taken, my last post on this thread. That post by you @JMichaelTX actually clarfied a lot for me. I get it. Well done. My apologies too @JMichaelTX in the last discussion where you tried to help me, I didn't see that there was link to a wikipedia article on variables in computing. Had I read that I would have made at least some progress I think. I just didn't read it as a link at the time.

I appreciate this thread was about 'tokens' but what a token is is caught up with other stuff. Now I know it is more like a function I understand. The excel analogy was useful too.

But point taken and in fact, at last, I saw something that clarified it for me so thanks. Thanks to @Tom too for pushing us there. It is hard JMichael when you don't know what you don't know so to speak and this is a long jump from most automation for many of us.

1 Like