Skip to content

Simplify example 6 #127

@grahamison

Description

@grahamison

The example odd_or_even function in example 6 could be improved.

Suggestions:

  • Put the checks at the top
  • Put the type check before the length check
  • Simplify the non-integer check to x %% 1 != 0
  • Consider returning odd or even rather than printing, to reflect more typical usage, and it might make the distinction between the checks and the function behaviour visually clearer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions