Skip to content

Commit

Permalink
added functional programming Function in Function
Browse files Browse the repository at this point in the history
  • Loading branch information
poncoe committed Aug 28, 2019
1 parent 6145b68 commit 052e317
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/functionalprogramming/FuncInsideFunc.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package functionalprogramming

fun sum(valueA: Int, valueB: Int, valueC: Int): Int {
fun validateNumber(value: Int) {
if (value == 0) {
throw IllegalArgumentException("value must be better than 0")
}
}

validateNumber(valueA)
validateNumber(valueB)
validateNumber(valueC)

return valueA + valueB
}

0 comments on commit 052e317

Please sign in to comment.