Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Change if to ternary operator #7

Closed
@giggio

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;

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions