Skip to content

Instantly share code, notes, and snippets.

@mikekavouras
Created November 5, 2015 23:52
Show Gist options
  • Select an option

  • Save mikekavouras/d8d47c694e2c12a253ca to your computer and use it in GitHub Desktop.

Select an option

Save mikekavouras/d8d47c694e2c12a253ca to your computer and use it in GitHub Desktop.
func doTheThing(num: Int) -> Int {
guard num != 1 else {return 1}
let diff = [0, -1, 1][num % 3]
print("\(num), \(diff)")
return doTheThing((num + diff) / 3)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment