Implemented a sample that tests recursion, if statements, and returns in the middle