Loading ...
Sorry, an error occurred while loading the content.

Variable syntax in NoteTab

Expand Messages
  • ebbtidalflats
    Layman999 has pointed to one of the sharpest curves in learning NoteTab s clip code, the variable syntax. Back when I first tried to code in clip code, I wish
    Message 1 of 3 , Dec 12, 2011
    • 0 Attachment
      Layman999 has pointed to one of the sharpest curves in learning NoteTab's clip code, the variable syntax. Back when I first tried to code in clip code, I wish someone had exlained to me the strange variable syntax in NoteTab.

      The followint is my attempt to clarify the difference between using a caret (^) and NOT using the caret with variables.


      1. NoteTab needs the '^' (caret) character to start parsing variables
      ^%variablename% in clip code is replaced by whatever the variable
      "%variablename%" contains.

      With the caret, a variable is PARSED.
      Without the caret, you ASSIGN to the variable.

      For that matter, NoteTab uses the caret to PARSE all special
      constructs (functions, wizards, commands, etc.).


      2. Clip code requires, that you DROP the caret, when assigning
      values to a variable (^!Set, ^!Inc, ^!Dec, ^!Append, etc).

      ^!Set %variablename%=value

      If you forget to drop the caret, you will assign the new
      value to the content of the variable, as if the content were
      a variable name !!

      For example:

      ^!Set %variablename%=5
      ^!Set ^%variablename%=20
      ;same as
      ^!Set 5=20

      ^%variablename% still contains 5.
      ^%5% contains 20



      Note, that the requirement for the %...% wrapper around variable names is only when parsing, but NoteTab will assign value to variable that are not so wrapped.

      However, to avoid confusion, it is better to ALWAYS use the wrapper, and add the caret, when extracting the variable's value.


      Eb
    • Alec Burgess
      Eb: very nice summary! Your comment: Without the caret, you ASSIGN to the variable. is one I hadn t appreciated. I remember in early days struggling with how
      Message 2 of 3 , Dec 12, 2011
      • 0 Attachment
        Eb: very nice summary!
        Your comment: "Without the caret, you ASSIGN to the variable." is one I
        hadn't appreciated.
        I remember in early days struggling with how to write ^!inc var_name
        and ^!dec var_name.
        Above makes it clear why they should not have preceding ^.

        On 2011-12-12 22:02, ebbtidalflats wrote:
        > Layman999 has pointed to one of the sharpest curves in learning
        > NoteTab's clip code, the variable syntax. Back when I first tried to
        > code in clip code, I wish someone had exlained to me the strange
        > variable syntax in NoteTab.
        >
        > The followint is my attempt to clarify the difference between using a
        > caret (^) and NOT using the caret with variables.
        >
        > 1. NoteTab needs the '^' (caret) character to start parsing variables
        > ^%variablename% in clip code is replaced by whatever the variable
        > "%variablename%" contains.
        >
        > With the caret, a variable is PARSED.
        > Without the caret, you ASSIGN to the variable.
        >
        > For that matter, NoteTab uses the caret to PARSE all special
        > constructs (functions, wizards, commands, etc.).
        >
        > 2. Clip code requires, that you DROP the caret, when assigning
        > values to a variable (^!Set, ^!Inc, ^!Dec, ^!Append, etc).
        >
        > ^!Set %variablename%=value
        >
        > If you forget to drop the caret, you will assign the new
        > value to the content of the variable, as if the content were
        > a variable name !!
        >
        > For example:
        >
        > ^!Set %variablename%=5
        > ^!Set ^%variablename%=20
        > ;same as
        > ^!Set 5=20
        >
        > ^%variablename% still contains 5.
        > ^%5% contains 20
        >
        > Note, that the requirement for the %...% wrapper around variable names
        > is only when parsing, but NoteTab will assign value to variable that
        > are not so wrapped.
        >
        > However, to avoid confusion, it is better to ALWAYS use the wrapper,
        > and add the caret, when extracting the variable's value.

        --
        Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)
      • Don
        I just use Sheri s wonderful clip code syntax ... it syntaxes for me :-)
        Message 3 of 3 , Dec 12, 2011
        • 0 Attachment
          I just use Sheri's wonderful clip code syntax ... it syntaxes for me :-)

          On 12/12/2011 10:29 PM, Alec Burgess wrote:
          > Eb: very nice summary!
          > Your comment: "Without the caret, you ASSIGN to the variable." is one I
          > hadn't appreciated.
          > I remember in early days struggling with how to write ^!inc var_name
          > and ^!dec var_name.
          > Above makes it clear why they should not have preceding ^.
        Your message has been successfully submitted and would be delivered to recipients shortly.