Tips for running some conditional statements in parallel environments

I want to run some conditional statements in every single environment out of n parallel environments.

I wonder if it would be too computationally expensive and time consuming to do so by running if statement in for loop that runs from 0th to nth environment.

I saw torch.where() function does a similar thing but I want to do something more than that.

Can anyone give me some tips or ideas? Thank you.