Ad
Code
Diff
  • def multiply_and_add_one(a, b):
        return a * b + 1
    • def multiply_and_add_one(a, b):
    • return a * b - 1 + 2 - 1 + 1 - 1 + 1
    • return a * b + 1
Code
Diff
  • package kata
    
    func Price(s,p int)int{return(s*p+1)*map[bool]int{true:1,false:0}[s>0]}
    
    • package kata
    • func Price(servings, price int) int {return map[bool]int{true: servings*price + 1, false: 0}[servings > 0]}
    • func Price(s,p int)int{return(s*p+1)*map[bool]int{true:1,false:0}[s>0]}
Code
Diff
  • package kata
    
    func Price(servings int, price int) int {
    	if servings > 0 {
    		return servings*price + 1
    	}
    	return 0
    }
    • package kata
    • func Price(servings int, price int) int {
    • if servings > 0 {
    • return servings * price + 1
    • } else {
    • return 0
    • }
    • if servings > 0 {
    • return servings*price + 1
    • }
    • return 0
    • }