a function that gets an integer and returns a double rounded 1 decimal if its bigger than 1000 in swift

main.swift
func roundDouble(value: Int) -> Double {
    if value > 1000 {
        return Double(value).rounded(toPlaces: 1)
    } else {
        return Double(value)
    }
}
163 chars
8 lines

related categories

gistlibby LogSnag