以下代码:
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
我做错了什么?