[go: nahoru, domu]

Skip to content

Commit

Permalink
add complexity code
Browse files Browse the repository at this point in the history
  • Loading branch information
tarappo committed Nov 11, 2022
1 parent 565b9d6 commit bcab8da
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion ci-sample/Sample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,33 @@ class Sample {
func add(_ n1: Int, _ n2: Int) -> Int {
return n1 + n2
}


// Complexity code
func sampleA(number: Int) -> Bool {
if(number > 2) {
if(number > 3) {
if(number > 4) {
return true
} else {
return false
}
}
}
return false
}

func sampleB(number: Int) -> Bool {
switch(number) {
case 1:
return false
case 2:
return true
case 3:
return false
case 4:
return true
default:
return false
}
}
}

0 comments on commit bcab8da

Please sign in to comment.