Check if 1 value of one array inside another array array exists inside the master Array

I have a master array ($proccessarray) that has other arrays inside it ($proccessarray[0] and $proccessarray[1]).

There are some situations where I would like to check if 1 of the values of the one of the sub-arrays (‘proccess1’) that is inside the master array, but a simple comparison operator fails:

$ProcessList =@('proccess1','process2','process3','proccess4')
$proccessarray =@()

$proccessarray += @(,$ProcessList[0..1])
$proccessarray += @(,$ProcessList[2..3])

$proccessarray[0]
$proccessarray[1]

($ProcessList[0] -in $proccessarray)

What would be the appropriate way to check if that value is present under one of the sub-arrays?

Something like

ForEach ($SubArrayItem in $SubArray) {
If ($MasterArray -Contains $SubArrayItem) {
     Do Stuff
}
Else {
    Do something different
}
}

Or with more sub arrays to parse through…

$SubArrayCollection = @(SubArrayA, SubArrayB, SubArrayC)

ForEach ($SubArrayList in $SubArrayCollection) {
	ForEach ($SubArrayItem in $SubArrayList) {
		If ($MasterArray -Contains $SubArrayItem) {
			Do Stuff
		}
		Else {
			Do something different
		}
	}
}

Thanks corporalcupcake

i would like to check that under a condition, something like this

if ($ProcessList[0] -in $proccessarray)
{
Do something
}
else
{
dont do it
}

is this possible?

sure. I would just leave the else portion off. If it doesn’t match the criteria to get into the if statement, it won’t execute anything .