开发者

ASP.net - Does a return statement in function stop the function?

开发者 https://www.devze.com 2023-01-02 12:09 出处:网络
Given the function \'Returns true if no cell is > 1 Function isSolutionValid() As Boolean Dim rLoop As Integer

Given the function

'Returns true if no cell is > 1
Function isSolutionValid() As Boolean
    Dim rLoop As Integer
    Dim cLoop As Integer
    For cLoop = 0 To canvasCols - 1
        For rLoop = 0 To canvasRows - 1
            If canvas(cLoop, rLoop) > 1 Then
                Return False
            End If
        Next
    Next
    Return True
End 开发者_Python百科Function

When 'return false' is fired, I'm assuming that the function is stopped at that point and there's no need for exit fors and things like that?


That is correct.

See Function Statement.

Returns control to the code that called a Function, Sub, Get, Set, or Operator procedure.

0

精彩评论

暂无评论...
验证码 换一张
取 消