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

13152Re: [Clip] ^!If Bug ?

Expand Messages
  • Alan_C
    Jan 5, 2005
      John Mitchell wrote:

      >^!Set %comment%=">>"
      >^!Select paragraph
      >^!Set %Str%=^$StrCopyLeft(^$GetSelection$;2)$
      >^!If ^%Str%=^%comment% ^!Prompt ^%Str%=^%comment%
      >^!If ^%comment%=^%Str% ^!Prompt ^%comment%=^%Str%
      >; End of clip -------
      >
      >If I run it against an open document containing arbitrary text the first
      >^!If tests TRUE and the second tests FALSE
      >
      1. same here.

      >, except when the first two
      >characters of the current paragraph are >>, in which case both tests
      >resolve to FALSE!!
      >
      >
      2. same here.

      >Am I about to be mightily embarrassed when someone points out an obvious
      >explanation?
      >
      Not obvious. It is just my speculation.

      # 2 above, each variable has >> inside it.

      combine that with the = that you have in between each of the two
      variables results in:

      >>=>>

      And that looks like it could mean "greater than or equal to"

      Perhaps the parser gets confused. Technically I suppose it shouldn't.

      I just tested:

      ^!Set %comment%=">>"
      ^!Select paragraph
      ^!Set %Str%=^$StrCopyLeft(^$GetSelection$;2)$
      ^!IfSame "^%comment%" "^%Str%" next else Skip
      ^!Prompt ^%comment% ^%Str%
      ;--------

      Works fine.

      Alan.
    • Show all 21 messages in this topic