Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
I'm trying to only proceed (mark correct) if word 2 is on the same line as word 1. Believe it or not, I had this working the other day, but can't find my code in the hundreds of little practice stacks I have.
repeat for each word tWord in gSentence
if tWord is among the words of gSentence and word 2 of gSentence is "Scooby-Doo" then put true into tContains
end repeat
answer tContains
repeat for each word tWord in gSentence
if tWord is among the words of gSentence and word 2 of gSentence is "Scooby-Doo" then put true into tContains
end repeat
answer tContains
Thanks Dave. Seems to hang up LC on my setup, I have to force quit LC. Running 7.0.2 rc 1 build 10024, on OSX Yosemite 10.10.1.
I guess it could be that my text file is a thousand lines, but without the repeat I can find tWord in a split.
Ah if you're using split you are creating an array and maybe should be dealing with elements rather than words - exactly how are you populating your variables?
A 'repeat for each' should be pretty fast and by no means should mean you have to force quite LiveCode - are you by any chance reading the text file one at a time rather than putting it into a variable? Something strange appears to be going on with your code, maybe give more background or ideally more code...
dave.kilroy wrote:Ah if you're using split you are creating an array and maybe should be dealing with elements rather than words - exactly how are you populating your variables?
A 'repeat for each' should be pretty fast and by no means should mean you have to force quite LiveCode - are you by any chance reading the text file one at a time rather than putting it into a variable? Something strange appears to be going on with your code, maybe give more background or ideally more code...