Skip to content

Instantly share code, notes, and snippets.

@leemorgan
leemorgan / Fibonacci.swift
Last active February 22, 2024 21:37
Fibonacci series in Swift
// Fibonacci series
// F[n] = F[n-1] + F[n-2]
// 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
// Find the fibonacci number for n interations
func fibonacci(n: Int) {
var num1 = 0
var num2 = 1
@mattt
mattt / NSDecimalNumber.swift
Last active April 1, 2023 00:06
NSDecimalNumber Additions for Swift
import Foundation
// MARK: - Comparable
extension NSDecimalNumber: Comparable {}
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool {
return lhs.compare(rhs) == .OrderedSame
}