Skip to content

Instantly share code, notes, and snippets.

@TarasShu
Last active June 11, 2020 10:07
Show Gist options
  • Save TarasShu/82e816621ec84879f0d684671eed5ca7 to your computer and use it in GitHub Desktop.
Save TarasShu/82e816621ec84879f0d684671eed5ca7 to your computer and use it in GitHub Desktop.
let totalRent = 5300
let electrecityBills = 1241
let arnonaBill = 153
var roomates = 3
let repairBill = 414
var month = 0
func electrecity(_ name: String) -> String {
if name != "Taras" {
month == 4
return "\(name) owes \(month * electrecityBills / roomates) for electrecity"
} else if name == "Oleg" {
month == 3
return " \(name) owes \(month * (electrecityBills - repairBill) / roomates) for electrecity"
}
if name == "Taras" {
month == 1
return " \(name) owes \(month * (electrecityBills - repairBill) / roomates) for electrecity"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment