Re: FORALL STATEMENT



jdturner wrote:
Experts,

I have a recurring application need where I have many conditions to be
evaluated simultaneously, with only a single valid response. For
example, one might have the following code fragment:

forall( 1 = 1:n, all( mask=v-a(i) == 0 ) ) tmp(1) = i
ans: tmp(1)

I know that forall wants an array solution==> I have provided a
artifical array with one location being set equal to i. My question
is: (1) is there another way, (2) is this portable?

FORALL is, fundamentally, an array assignment statement, but it appears to me that you're trying to turn it into a loop.

Since you're trying to find a single index i, I suspect that the most efficient (and also least tortured) way to do what you want is to use a vanilla DO loop to locate the correct index, save it, and EXIT out of the loop.
.



Relevant Pages

  • RE: Error 3021
    ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)
  • RE: Error 3021
    ... Kevin Backmann ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)
  • RE: Error 3021
    ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)
  • Re: Displaying a large amount of data quickly (VB6)
    ... >>> involving a loop of VB code would be too slow. ... but I'd sure be interested to know if that StringBuilder ... Array elements: 25000 ... Array construction: 17 ...
    (microsoft.public.vb.controls)
  • RE: Error 3021
    ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)