Coffeescript:无与伦比的突出错误

时间:2013-12-03 05:18:19

标签: coffeescript

以下代码:

binary_search = (arr, val)->
    arr = arr.concat(arr)
    lower = 0 ; upper = arr.length-1
    while upper-lower > 1
        mid = Math.floor((lower+upper)/2)
        if arr[mid] is val
            return mid
        if arr[mid] < val
            if arr[mid-1] < arr[mid+1]
                low = mid+1
            else 
                up = mid-1
        else
            if arr[[mid-1] > arr[mid+1]
                low = mid+1
            else 
                up = mid-1
    return -1

and get the following error:

   error: unmatched OUTDENT
            up = mid-1

我做错了什么?

0 个答案:

没有答案