Skip to content

Refactor driver functions to use early return pattern#89

Open
utsav-pal wants to merge 1 commit intofortran-lang:mainfrom
utsav-pal:refactor/remove-nested-validation-blocks
Open

Refactor driver functions to use early return pattern#89
utsav-pal wants to merge 1 commit intofortran-lang:mainfrom
utsav-pal:refactor/remove-nested-validation-blocks

Conversation

@utsav-pal
Copy link

Replace nested if blocks with early return guards in 5 driver functions to improve code readability and reduce indentation levels.

Changes:

  • hybrd1: Convert nested validation to early returns
  • hybrj1: Convert nested validation to early returns
  • lmder1: Convert nested validation to early returns
  • lmdif1: Convert nested validation to early returns
  • lmstr1: Convert nested validation to early returns

All functions maintain identical behavior - only code structure changed. Validation logic is now clearer with each parameter check on its own line.

Fixes #46

Replace nested if blocks with early return guards in 5 driver functions
to improve code readability and reduce indentation levels.

Changes:
- hybrd1: Convert nested validation to early returns
- hybrj1: Convert nested validation to early returns
- lmder1: Convert nested validation to early returns
- lmdif1: Convert nested validation to early returns
- lmstr1: Convert nested validation to early returns

All functions maintain identical behavior - only code structure changed.
Validation logic is now clearer with each parameter check on its own line.

Fixes fortran-lang#46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exit early to avoid waterfall code

1 participant

Comments