[ad_1]
I’ve a perform that appears one thing like this:
func mainFunction(mainValue: Int) -> Bool {
if flag1.isActive() && val1>mainValue {
return false
}
}
Now, the road flag1.isActive() && val1>val2 is utilized in multiple place within the code. So I wish to add flag1.isActive() && val1>val2 right into a perform. For that I attempted one thing like beneath, however it did not work:
func subFunction(mainVal: Int) {
flag1.isActive() && val1>mainVal
}
After which known as the perform as:
func mainFunction(mainValue: Int) -> Bool {
if subFunction(mainVal: mainValue) {
return false
}
}
However that is giving the error as Can not convert worth of sort '()' to anticipated situation sort 'Bool'
[ad_2]
