---
title: "if"

doc_type: static
doc_category: static
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/sline/tag/if'
  md: 'https://developer.shopline.com/docs/sline/tag/if.md'
---

# if


    Renders the specified code block if the evaluation result of a specific condition is truthy.

    



```sline
{{#if condition }}
  expression
{{/if}}
```



    
       `condition`\: The condition to evaluate.
    







    
## Examples

        
            ### Single condition

            The following example compares two values of the same type and renders the specified code block if the specified condition is met.

            

            
<SlineExample path={'/products/product-009-92883-19'} objects={ 
    ["product"] 
}>
```sline
{{#if product.price > 30 }}
    product price more than 30
{{/if}}
```
</SlineExample>
            
        
            ### Multi-branch logic

            The following example compares two values of the same type and renders different code blocks when different conditions are met.

            

            
<SlineExample path={'/products/product-009-92883-19'} objects={ 
    ["product"] 
}>
```sline
{{#if product.price < 30 }}
    product price less than 30
{{#else if product.price > 30 /}}
    product price more than 30
{{/if}}
```
</SlineExample>
            
        
            

            The following example compares two values of the same type and renders different code blocks based on whether the specified condition is met.

            

            
<SlineExample path={'/products/product-009-92883-19'} objects={ 
    ["product"] 
}>
```sline
{{#if product.price < 30 }}
    product price less than 30
{{#else/}}
    product price more than 30
{{/if}}
```
</SlineExample>
            
        
    
