title: Can you have multiple IN conditions in a PowerShell ForEach loop?
body: <p>I have the following sample code in a function:</p>
  
  <pre><code>[array]$ARR = $null
  
  foreach ($file in $fileTable.identical)
  {
     [hashtable]$HT=@{
         'FileName' = $file.Name
         'AppName' = $file.App
         'GroupName' = $file.Group
         'Valid' = $true
     }
     $ARR += $HT
  }
  foreach ($file in $fileTable.removed)
  {
     [hashtable]$HT=@{
         'FileName' = $file.Name
         'AppName' = $file.App
         'GroupName' = $file.Group
         'Valid' = $false
     }
     $ARR += $HT
  }
  foreach ($file in $fileTable.modified)
  {
     [hashtable]$HT=@{
         'FileName' = $file.Name
         'AppName' = $file.App
         'GroupName' = $file.Group
         'Valid' = $false
     }
     $ARR += $HT
  }
  
  return $ARR
  </code></pre>
  
  <p>+3 more foreach loops for other $fileTable.[properties] where 'Valid' = $false as well. </p>
  
  <p>Instead of having to repeat the block of code multiple times, I want to do something like:</p>
  
  <pre><code>foreach (($file in $fileTable.removed) -and ($file in $fileTable.modified))
  {
     [hashtable]$HT=@{
         'FileName' = $file.Name
         'AppName' = $file.App
         'GroupName' = $file.Group
         'Valid' = $false
     }
  }
  </code></pre>
  
  <p>So only variable different in the hashtable will be $value.
  $fileTable is a pscustomobject with a few custom properties like identical, modified, added, removed. </p>
  
  <p>I know what I want is not possible in foreach loops but I'm looking for a similar solution to reduce the number of lines of code. Any help would be appreciated :) </p>
  
  <p>Thanks!</p>