Skip to content

Commit

Permalink
Even or Odd
Browse files Browse the repository at this point in the history
  • Loading branch information
PheRum committed Jun 15, 2024
1 parent 08eba1f commit 67a4420
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
5 changes: 5 additions & 0 deletions 8_kyu/Even or Odd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Even or Odd

https://www.codewars.com/kata/53da3dbb4a5168369a0000fe

Create a function that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers.
19 changes: 19 additions & 0 deletions 8_kyu/Even or Odd/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { evenOrOdd } from "./index";

describe("Tests", () => {
it("evenOrOdd(1) should return 'Odd'", function () {
expect(evenOrOdd(1)).toBe("Odd");
});
it("evenOrOdd(2) should return 'Even'", function () {
expect(evenOrOdd(2)).toBe("Even");
});
it("evenOrOdd(-1) should return 'Odd'", function () {
expect(evenOrOdd(-1)).toBe("Odd");
});
it("evenOrOdd(-2) should return 'Even'", function () {
expect(evenOrOdd(-2)).toBe("Even");
});
it("evenOrOdd(0) should return 'Even'", function () {
expect(evenOrOdd(0)).toBe("Even");
});
});
3 changes: 3 additions & 0 deletions 8_kyu/Even or Odd/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function evenOrOdd(number: number): string {
return number % 2 === 0 ? "Even" : "Odd";
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

### Katas solved

`Total`: 102 \
`8_kyu`: 85 \
`Total`: 103 \
`8_kyu`: 86 \
`7_kyu`: 13 \
`6_kyu`: 4 \
`5_kyu`: 0 \
Expand Down
1 change: 0 additions & 1 deletion kata.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
8 kyu - Even or Odd - https://www.codewars.com/kata/53da3dbb4a5168369a0000fe
8 kyu - Beginner - Reduce but Grow - https://www.codewars.com/kata/57f780909f7e8e3183000078

0 comments on commit 67a4420

Please sign in to comment.