Do you have a sample What you are actually doing?

https://ss64.com/ps/if.html

the basic is this:

if($condition){
    #true
    # do stuff
}
else{
    #false
    # do other stuff
}

If you post code, please use the ‘Insert Code’ button. Please and thank you!

codebutton_small.png