Visitar URL original
Change if to ternary operator · Issue #7 · code-cracker/code-cracker · GitHub
Skip to content

Change if to ternary operator #7

Closed

Description

@giggio

Two expected scenarios

Return

if (something)
    return a;
else
    return b;

Becomes:

return something ? a : b;

If necessary, cast a to the expected value;

Attribution

if (something)
    v = a;
else
    v = b;

Becomes:

v = something ? a : b;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions