Skip to content

Put the smallest code in a block whenever possible #3

@AkshDesai04

Description

@AkshDesai04

When using if, try, switch or other similar flow control mechanisms, always encapsulate the smallest block of code possible.
Line 31 to line 44 is exactly the same other then 1 function call.
So only put that function call in the if block.
This creates less code and you dont have to repeat your code again which is happening right now
This will help in debugging since if there is a bug, you will have to change it from only 1 place rather then multiple places.
Happy coding :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions