Examine the different types of logic gates and their functions.