Ternary operator feature support
I know this feature has been requested before in this thread: https://github.com/Shopify/liquid/issues/236 **And based on 85 liking the idea, versus 2 not liking the idea says something.** But that issue was closed back in 2016, and as the docs says: ```liquid Things we will merge - Features that are likely to be useful to the majority of Liquid users ``` I personally still see a great advantage in having the opportunity to use ternary operators, the code is way more slick and friendly to look at. I saw the ```default``` filter was suggested, but doesn't always come in handy, when using logic. **Without ternary** ```liquid {%- liquid assign has_selected_variant = false if product.selected_variant != nil assign has_selected_variant = true endif -%} ``` **With ternary** ```liquid {%- assign has_selected_variant = product.selected_variant != nil ? true : false -%} ```
Posted by madsenmm on Jun 23, 2020, 9:04 AM
Tags
Related issues
- Add 65536 size support for maps
- TypeScript 7.1 Iteration Plan
- nvim-treeconfig: upstream nvim-treesitter
- Add the "action" and "method" attributes to <button>
- [FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
- > We were imposed GitHub for so many exercises!
Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments
support (Software)
Add 65536 size support for maps
TypeScript 7.1 Iteration Plan
nvim-treeconfig: upstream nvim-treesitter
Add the "action" and "method" attributes to <button>
[FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
> We were imposed GitHub for so many exercises!
Add support for Visual Studio 2026 Integration
Support for Helm v4
Ternary operator feature support
I know this feature has been requested before in this thread: https://github.com/Shopify/liquid/issues/236 **And based on 85 liking the idea, versus 2 not liking the idea says something.** But that issue was closed back in 2016, and as the docs says: ```liquid Things we will merge - Features that are likely to be useful to the majority of Liquid users ``` I personally still see a great advantage in having the opportunity to use ternary operators, the code is way more slick and friendly to look at. I saw the ```default``` filter was suggested, but doesn't always come in handy, when using logic. **Without ternary** ```liquid {%- liquid assign has_selected_variant = false if product.selected_variant != nil assign has_selected_variant = true endif -%} ``` **With ternary** ```liquid {%- assign has_selected_variant = product.selected_variant != nil ? true : false -%} ```
Comments (0)
No comments yet. Start the discussion.