Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to limit the number of "forech" outputs?
#1
I would like to limit the output to only five of the lists included in the variable"s".

What should I do if I want to do "BREAK" after I output the 5 lists?

I'd like to know how to solve it.


Ex:
ARRAY(str) a="1[]2[]3[]4[]5[]6[]7[]8[]9[]10"
int i
for(i 0 a.len)
    if(i=5) break
    out a[i]


out

str s=
;c:\program files\myexe1.exe
;c:\program files\myexe2.exe
;c:\program files\myexe3.exe
;c:\program files\myexe4.exe
;c:\program files\myexe5.exe
;c:\program files\myexe6.exe
;c:\program files\myexe7.exe
;c:\program files\myexe8.exe
;c:\program files\myexe9.exe
;c:\program files\anotherone.exe

str sw=
;myexe1
;mystuff
;anotherone
;somethingelse

sub.Included_Words s sw _s
out _s
#sub Included_Words
function str&Word_list str&Included_Words str&outlist


ARRAY(str) am au AM AU
foreach _s Included_Words
,if(find(Word_list _s 0 1)<0) au[]=_s
,else am[]=_s

foreach _s Word_list
,for(_i 0 am.len)
,,if(find(_s am[_i] 0 1)>=0) break
,if(_i<am.len)
,,AM[]=_s;
,,outlist.addline(_s 1)
,else
,,AU[]=_s


Messages In This Thread
How to limit the number of "forech" outputs? - by BK - 04-16-2019, 02:42 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)