Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement complex conditionals for naming patterns #1293

Closed
HubMiner opened this issue Nov 6, 2022 · 1 comment
Closed

Implement complex conditionals for naming patterns #1293

HubMiner opened this issue Nov 6, 2022 · 1 comment

Comments

@HubMiner
Copy link

HubMiner commented Nov 6, 2022

Please consider implementing support for complex conditionals, allowing to chain 2 or more statements.
AND, OR, SWITCH

@VolatilePulse
Copy link
Collaborator

VolatilePulse commented Nov 6, 2022

Technically, all of these are already supported as a standard #ifexpr supports all of these. That said, it can be cleaner (read, less messy) to support AND/OR within the conditions themselves. I'm not sure how helpful a switch would be as shown below. Consider the following:

// AND
if (condition1 && condition2)
{
    // Do something
}

// Is equal to
if (condition1)
{
    if (condition2)
    {
        // Do something
    }
}

// ASB equivalent
{{#ifexpr: condition1 | {{#ifexpr: condition2 | /* Do something */}}}}
// OR
if (condition1 || condition2)
{
    // Do something
}

// Is equal to
if (condition1)
{
    // Do something
}
else
{
    if (condition2)
    {
        // Do something
    }
}

// ASB equivalent
{{#ifexpr: condition1 | /* Do something */ | {{#ifexpr: condition2 | /* Do something */}}}}
// SWIITCH
switch (object)
{
    case equality1:
        // Do something1
        break;
    case equality2:
        // Do something2
        break;
}

// Is equal to
if (object == equality1)
{
    // Do something1
}
else
{
    if (object == equality2)
    {
        // Do something2
    }
}

// ASB Equivalent
{{#ifexpr: object == equality1 | /* Do something1 */ | {{#ifexpr: object == equality2 | /* Do something2 */}}}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants