Skip to content

off by one counting #1

@Rumpick

Description

@Rumpick

Issue Overview

Select lines won't be used in Solutions/fortune.

Description

In Solutions/fortune, you provide 4 options for $waitingnumber in the case statement, but due to $RANDOM % 3 never returning a 3, the last option will never be used.

Likewise, there are 10 options in the fortunes array but since you have 1 + $RANDOM % 10, there will never be a 0, so the first object in the array will never get used. And there is a possibility of the value of $mysterynumber being 10, which will result in no fortune at all.

I know this video will likely not be recorded, but I thought it would be beneficial to point out.

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