Syntax for incrementing a numeric 'word'

dunbarx at aol.com dunbarx at aol.com
Wed Jun 27 08:52:25 EDT 2012


The original issue, the error thrown by your script, can be traced back to the fact that:


line tLine of fld "results"


"tLine" is not an integer. A line number has to be so designated, and your "line" is of the form:


"someWord" & tab & 1


This throws the parser for a loop.


Craig Newman



-----Original Message-----
From: Keith Clarke <keith.clarke at clarkeandclarke.co.uk>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, Jun 27, 2012 4:25 am
Subject: Syntax for incrementing a numeric 'word'


Hi folks,
I'm working on a simple script to identify and count the unique words dumped 
into a 'Source' field to create a 'Results' list field with the word and 
counter.

However, this script is throwing errors at the line when I attempt to increment 
the second word by adding 1 to it. What's wrong with the syntax for incrementing 
the counter chunk? 

on mouseUp
   put empty into field "Results"
   repeat for each word tWord in field "Source"
      if field "Results" is empty then put tWord & tab & 1 after field "Results"
      if tWord is among the words of field "Results" then
         repeat for each line tLine in field "Results"
            if word 1 of tLine <> tWord 
            then exit repeat
            else add 1 to word 2 of line tLine in field "Results"
            end repeat
         else put tWord & cr after field "Results"
      end repeat
end mouseUp 

Best,
Keith..
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the Use-livecode mailing list