PL/Python

[Python] short circuit evaluation

SweetDev 2021. 12. 15. 12:46
# short circuit evaluation
data = [1]

index = 1
value = 1

while index < len(data) and data[index] != value:
    index += 1

while문의 앞쪽이 false이면 뒤쪽은 아예 실행하지 않아서

index out of range오류가 안나게 된다