Nth Even Number

Published by Einy in

Create a function that takes a number n and returns the nth even number beginning with 0 as the first.

Examples

nth_even(1) ➞ 0
# 0 is first even number

nth_even(2) ➞ 2
# 2 is second even number

nth_even(100) ➞ 198

Notes

N/A

Watch a quick demo on how Edabit works.