in reply to Re: Stupidest Prime Number detector ever!!
in thread Stupidest Prime Number detector ever!!
The naming convention for SomeModule.pm test code is
SomeModule.t. This is not enforced in any way, but it's what
everyone expects.
| Well, it's what I expected, anyway.
See Update Note 1 below.
Some comments on the is_lousy_prime() function code.
The exit; statement in the code above will never be reached. No code in the function will be executed after the return 0; statement executes. There's another example of this unreachable-code syntax in the foreach loop further on in the function.if ( $prime_candidate <= 0 ) { return 0; exit; }
This is more involved, but essentially the same thing is happening: the exit built-in function will never be executed.exit if $prime_candidate == 1 && return 0;
And one more thing: Please, please choose a reasonable indentation style and stick to it!
Update:
Notes:
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Stupidest Prime Number detector ever!! [*.t naming convention]
by kcott (Archbishop) on Jun 24, 2021 at 03:34 UTC | |
by eyepopslikeamosquito (Archbishop) on Jun 24, 2021 at 10:48 UTC | |
by choroba (Cardinal) on Jun 24, 2021 at 12:34 UTC | |
|
Re^3: Stupidest Prime Number detector ever!!
by Anonymous Monk on Jun 23, 2021 at 23:50 UTC |