How to create conditional logic in a template

Source: JamezJ.com