If you are not familiar with Snippets I recommend learning about them and using them! I love the built in ISE snippets, and have made many of my own for tasks I administrate daily. From the ISE console for example, if you click in the scripting pane and press “Ctrl + J” you will get a menu of all the snippets loaded in the ISE. Its very helpful for recalling syntax, such as an If statement or for advanced function (cmdlet). If statements always follow “If(Evaluation code here){Condition met}Else{Condition not met}”. Another thing that makes things easier is not getting too complex in your evaluation code within the If statement. For example if there is complex logic involved create a variable with the condition statement and then check the variable. Another thing I will suggest that has worked beautifully for me is formatting the code for readability. The way I format my code is not often seen, but to me it makes it SO much easier to see where the brackets end, etc. Making it easier to troubleshoot and see where things get mixed up. Also, don’t forget we get free line breaks after a pipeline, which lends further to readability. Some examples below
Built in “IF” Snippet from ISE