What is wrong with this for loop?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf What is wrong with this for loop?

  • Creator
    Topic
  • #48485
    Hyunyoung Park
    Participant

      This for loop basically checks a field consisted of six subfields in it and get the length of each subfield. It adds them up to get the total length of the field.

      for {set idx 0}{$idx < 6}{incr idx 1}{   set tempVar [lindex $xlateInVals $idx]   set count [expr $count+[string length $tempVar]] } errorInfo: extra characters after close-brace while compiling “for {set idx 0”    (compiling body of proc “xlt_40_chars”, line 7)    invoked from within “xlt_40_chars”

      Where is extra charcters that this error msg is talking about????

      Any help will be appreciated.

    Viewing 1 reply thread
    • Author
      Replies
      • #58755
        Jim Kosloskey
        Participant

          Hyunyoung,

          Try putting whitespace between your end and start curly braces like this:

          for {set idx 0} {$idx < 6} {incr idx 1} {  set tempVar [lindex $xlateInVals $idx]  set count [expr $count+[string length $tempVar]] }

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #58756
          Hyunyoung Park
          Participant

            It works!! Thanks!!!

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.