Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB

Call Functions Until One Meets Condition

5.00/5 (1 vote)
6 Apr 2011CPOL 5.8K  
Sorry, but I don't like adding additional artificial elements like function arrays . I would code it as following:If isok(Step1()) OrElse isok(Step2(1,1)) OrElse isok(Step3() OrElse isok(Step4() OrElse isok(0+1) thenend ifFunction isok(ByVal rc as Integer) As Boolean ...
Sorry, but I don't like adding additional artificial elements like function arrays . I would code it as following:

If isok(Step1()) OrElse
   isok(Step2(1,1)) OrElse
   isok(Step3() OrElse
   isok(Step4() OrElse
   isok(0+1) then
end if

Function isok(ByVal rc as Integer) As Boolean
    if(rc>=5) Return True
    return False
End Function
I think it's less coding and easier to understand.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)