Ternary operator
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
- AS A software engineer writing a Liquid template,
- I WANT TO use a ternary operator to assign values for truthy or falsey scenarios,
- SO THAT I can write this in one line instead of five.
- {% if url == "/" %}
- {% assign my_variable = "something" %}
- {% else %}
- {% assign my_variable = "something_else" %}
- {% endif %}
+ {% assign my_variable = url == "/" ? "something" : "something_else" %}
There is a huge amount of support for this crucial feature in twelve-year-old issue #236.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the requested syntax and prior discussion in issue #236, then locate the parser and assignment handling for Liquid expressions. Done means the shown ternary expression supports truthy and falsey values and has coverage demonstrating both branches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100