I have some kind of virus so I haven't been super productive over the last few days. I managed to start and finish my Swift homework on days 14-15.

This week's module was functions so we finally get to solve some more interesting problems. I'm still grateful for my background in programming.

My fibonacci function from homework. I'm not sure it's the most elegant solution, but it works.

func fibonacci(number: Int) -> Int {
    if number < 0 {
        let absoluteValue = abs(number)
        
        if number == -1 {
            return 1
        }
        
        return absoluteValue % 2 == 0 ?
            (fibonacci(number: (absoluteValue - 1)) + fibonacci(number: (absoluteValue - 2))) * -1 :
            fibonacci(number: (absoluteValue - 1)) + fibonacci(number: (absoluteValue - 2))
    }
    return number <= 1 ? number : fibonacci(number: (number - 1)) + fibonacci(number: (number - 2))
}

These early assignments aren't challenging for me but life outside of school is intense right now. I can use a break and something relatively easy to do.

Links to work:

Resources I used today:

Social posts:


Buy Me A Coffee