This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def indemnify_employee(salary, worked_months) | |
return 'without indemnify' if worked_months < 12 | |
calc_indemnify = -> (salary, worked_months) do | |
return salary * (worked_months.to_f / 12).ceil | |
end | |
calc_indemnify.call(salary, worked_months) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
func filterGreater(closure: (Int, Int) -> Bool, numbers: [Int], value: Int) -> [Int] { | |
var filterNumbers = [Int]() | |
for num in numbers { | |
if closure(num, value) { | |
filterNumbers.append(num) | |
} |