plotting – How to use an If-statement to plot a function

I am trying to use an if statement so that when the statement is true, plots a graph of the function and when false, returns 0. I know that the format of an if statement is If[x, TRUE, FALSE], but I don’t know how the input works when I want to check the function for x within the If-statement so that I can graph that function if it is true.