Conditional Blocks
Show a part of the snippet only when a condition is met.
A conditional block lets you dynamically show or hide fragments of your snippet
based on the values provided when you expand it. You can build simple if
statements or more complex if / elseif / else structures.
Inserting a Conditional Block
The easiest way is to use the Insert Placeholder button (or type {{),
choose Conditional Block / If Statement, and fill in the form. Snippety will
insert a full scaffold for you:
{@if|City == New York@}
<content shown when the condition is true>
{@endif@}
The block always starts with {@if@} and ends with {@endif@}. Everything
between them is included only when the condition evaluates to true.
Parameters
When inserting a conditional block, the form offers a few options:
1️⃣ Condition
The condition that decides whether the content is shown. See Condition Syntax below.
2️⃣ Include elseif branch (optional)
Adds an extra {@elseif@} branch with its own condition, checked when the if
condition is false.
3️⃣ Elseif condition (optional)
The condition used for the elseif branch.
4️⃣ Include else branch (optional)
Adds a fallback {@else@} branch, shown when none of the previous conditions
match.
5️⃣ Single line (optional)
By default, the markers are placed on separate lines with empty lines around the content for readability. Enable this option to keep everything on a single line.
Markers
A conditional block is built from four markers:
| Marker | Description |
|---|---|
{@if|...@} | Starts the block and defines the first condition. |
{@elseif|...@} | Adds another condition, checked when the previous ones are false. |
{@else@} | Marks the fallback branch, shown when no condition matches. |
{@endif@} | Ends the block. Every {@if@} must be closed with an {@endif@}. |
Only the first matching branch is included. If no condition matches and there is
no {@else@} branch, nothing is inserted.
Each marker "eats" its own line, so the surrounding empty lines are removed and the output stays clean.
Condition Syntax
A condition compares a placeholder with a value and evaluates to either true
or false:
<placeholder> <operator> <value>
For example:
City == New York
You reference a placeholder by its Field Title. The following placeholder types can be used in conditions:
Operators
| Operator | Meaning |
|---|---|
== | equals |
!= | does not equal |
~= | starts with |
=~ | ends with |
~~ | contains |
% | contains all values (Multiselect only) |
IN | equals any of the values (comma-separated) |
Logical Operators
Multiple conditions can be combined into a single expression using logical operators and parentheses:
| Operator | Meaning |
|---|---|
AND | all conditions must be true |
OR | at least one condition must be true |
( ) | use parentheses to group conditions |
Examples:
Name == John AND Age == 12
Name == John OR Name == Adam
Name IN John,Alex,Adam
(Place == Office Alpha OR Place == Office Beta) AND City == New York
AND and OR are recognized only as whole uppercase words, so values like
Andrew or sailor are not mistaken for logical operators.
Referencing Specific Placeholders
Text Variable
{@text|Item@}
Item =~ s— matches whenItemends withs.Item ~~ keyboard— matches whenItemcontainskeyboard.Item == keyboard OR Item == mouse— matches whenItemis exactlykeyboardormouse.
Selectable Value
A Selectable Value can be compared either by its value
or by its position in the list (starting from 1).
{@selectable|Color|red;green;blue;orange;black@}
Color == blue— matches whenblueis selected.Color == 3— matches when the 3rd value (blue) is selected.
Enable the Hidden option on a Selectable Value if you only want to use it in a condition without inserting its value into the output.
Multiselect
A Multiselect can be compared either by its value
or by its position in the list (starting from 1).
{@multiselect|Fruit|Apple;Orange;Kiwi;Watermelon@}
Fruit % 1,3— matches when bothAppleandKiwiare selected. Additional selections are allowed.Fruit == 1,3— matches only when exactlyAppleandKiwiare selected. Additional selections are NOT allowed.Fruit == Orange— matches when onlyOrangeis selected. Additional selections are NOT allowed.
Selectable Date
A Selectable Date is compared using its formatted text.
{@date|Deadline|dd.MM.yyyy|English@}
Deadline =~ 2026— matches dates ending with2026, for example15.03.2026.
Validation
Snippety validates the structure of your conditional blocks. You will see an error if:
- an
{@if@}is not closed with a matching{@endif@}, - an
{@elseif@},{@else@}, or{@endif@}appears outside an{@if@}block, - a block contains more than one
{@else@}, or an{@elseif@}after{@else@}, - a condition cannot be parsed.
Conditional blocks can also be nested inside each other.
Evaluation
When you expand a snippet, Snippety evaluates the conditions in the order they
appear. The first matching branch is included in the output, and the rest are
ignored. If no condition matches and there is no {@else@} branch, nothing is
inserted.
Placeholders in the inactive branches are not evaluated. That said, Script, AI Assistant, Simulated Keys, Cursor Position are not executed and do not cause any side effects.
The only exception is Auto-Incrementing Number, which is always incremented even in inactive branches.
Use Cases
This placeholder is useful when a single snippet needs to adapt to different situations without creating multiple variants.
Example
You use the same message template but want to add a special note only for priority customers:
Hello {@text|Name@},
Thank you for reaching out to our support team.
{@selectable|Plan|Free;Premium||YES@}{@if|Plan == Premium@}
As a Premium customer, your request will be handled with top priority.
{@else@}
We will get back to you within 3 business days.
{@endif@}
Best regards,
Support Team