# Control Flow Tags These tags are used to control the flow of logic in Liquid templates. They allow you to create conditions, loops, and manage how content is rendered based on different scenarios. Use these tags to add logic and branching to your templates. ## case Creates a switch statement to execute a particular block of code when a variable has a specified value. case initializes the switch statement, and when statements define the various conditions. An optional else statement at the end of the case provides code to execute if none of the conditions are met. **Input** ```liquid {% assign handle = "cake" %} {% case handle %} {% when "cake" %} This is a cake {% when "cookie", "biscuit" %} This is a cookie {% else %} This is not a cake nor a cookie {% endcase %} ``` **Output** ```text This is a cake ``` --- ## if Executes a block of code only if a certain condition is `true`. **Input** ```liquid {% if product.title == "Awesome Shoes" %} These shoes are awesome! {% endif %} ``` **Output** ```text These shoes are awesome! ``` You can add more conditions within `if` block with `elsif` or `else` **Input** ```liquid {% if false %} This won't render... {% elsif true %} ...but this will {% endif %} ``` **Output** ```text ...but this will ``` --- ## liquid Allows writing multiple tag statements on separate lines without wrapping each one in {% %} delimiters. **Input** ```liquid {%- liquid assign greeting = "Hello" assign name = "World" echo greeting | append: " " | append: name -%} ``` **Output** ```text Hello World ``` --- ## unless Executes a block of code only if a certain condition is `false` (the inverse of `if`). **Input** ```liquid {% unless product.title == "Awesome Shoes" %} These shoes are not awesome! {% endunless %} ``` **Output** ```text These shoes are not awesome! ``` You can add more conditions within an `unless` block with `elsif` or `else`. **Input** ```liquid {% unless false %} This will render... {% elsif true %} ...but this won't {% endunless %} ``` **Output** ```text This will render... ```