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

Unnecessary return declarations #11

Open
daopunk opened this issue Jan 19, 2025 · 0 comments
Open

Unnecessary return declarations #11

daopunk opened this issue Jan 19, 2025 · 0 comments
Assignees

Comments

@daopunk
Copy link
Collaborator

daopunk commented Jan 19, 2025

when a variable is declared in the return param, it is implied that it will be returned, so a return statement is not necessary:

  function getCircles(uint256[] calldata _ids) external view returns (Circle[] memory _circles) {
    _circles = new Circle[](_ids.length);
    for (uint256 i = 0; i < _ids.length; i++) {
      _circles[i] = circles[_ids[i]];
    }
    return _circles;
  }

can be:

  function getCircles(uint256[] calldata _ids) external view returns (Circle[] memory _circles) {
    _circles = new Circle[](_ids.length);
    for (uint256 i = 0; i < _ids.length; i++) {
      _circles[i] = circles[_ids[i]];
    }
  }
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