Inline test data structure changed
This commit is contained in:
committed by
Michael Bogdanov
parent
b37c0d3fff
commit
02c6bdeaa3
@@ -0,0 +1,25 @@
|
||||
package test
|
||||
|
||||
inline fun <T> runIf(f: (T) -> T, start: T, stop: T, secondStart: T) : T {
|
||||
if (f(start) == stop) {
|
||||
return f(start)
|
||||
}
|
||||
return f(secondStart)
|
||||
}
|
||||
|
||||
|
||||
inline fun <T> runIf2(f: (T) -> T, start: T, stop: T, secondStart: T) : T {
|
||||
val result = f(start)
|
||||
if (result == stop) {
|
||||
return result
|
||||
}
|
||||
return f(secondStart)
|
||||
}
|
||||
|
||||
inline fun <T> runIfElse(f: (T) -> T, start: T, stop: T, secondStart: T) : T {
|
||||
if (f(start) == stop) {
|
||||
return f(start)
|
||||
} else {
|
||||
return f(secondStart)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user