연산자 우선 순위 (Precedence)
로빈아빠
본문
연산자들의 우선순위는 두 개의 표현식중 어느것이 더 단단히 묶여 있는가를 명기한다. 예를들어 1 + 5 * 3은 16을 반환하지 18을 반환하지 않는다. 왜냐하면 곱하기("*")연산자가 더하기("+")연산자보다 우선순위가 높기 때문이다.
다음 표는 연산자의 우선순위를 나타낸다 가장 위에 있는 연산자의 우선순위가 가장 낮다.
Table 6-6. Operator Precedence
---------------------------------------------------------------------------------
Associativity Operators
---------------------------------------------------------------------------------
left ,
---------------------------------------------------------------------------------
left or
---------------------------------------------------------------------------------
left xor
---------------------------------------------------------------------------------
left and
---------------------------------------------------------------------------------
right print
---------------------------------------------------------------------------------
left = += -= *= /= .= %= &= |= ^= ~= <<= >>=
---------------------------------------------------------------------------------
left ? :
---------------------------------------------------------------------------------
left ||
---------------------------------------------------------------------------------
left &&
---------------------------------------------------------------------------------
left |
---------------------------------------------------------------------------------
left ^
---------------------------------------------------------------------------------
left &
---------------------------------------------------------------------------------
non-associative == != ===
---------------------------------------------------------------------------------
non-associative < <= > >=
---------------------------------------------------------------------------------
left << >>
---------------------------------------------------------------------------------
left + - .
---------------------------------------------------------------------------------
left * / %
---------------------------------------------------------------------------------
right ! ~ ++ -- (int) (double) (string) (array) (object) @
---------------------------------------------------------------------------------
right [
---------------------------------------------------------------------------------
non-associative new
---------------------------------------------------------------------------------
출처 : http://qdata.co.kr/bo/bbs/board.php?bo_table=pht&wr_id=41
다음 표는 연산자의 우선순위를 나타낸다 가장 위에 있는 연산자의 우선순위가 가장 낮다.
Table 6-6. Operator Precedence
---------------------------------------------------------------------------------
Associativity Operators
---------------------------------------------------------------------------------
left ,
---------------------------------------------------------------------------------
left or
---------------------------------------------------------------------------------
left xor
---------------------------------------------------------------------------------
left and
---------------------------------------------------------------------------------
right print
---------------------------------------------------------------------------------
left = += -= *= /= .= %= &= |= ^= ~= <<= >>=
---------------------------------------------------------------------------------
left ? :
---------------------------------------------------------------------------------
left ||
---------------------------------------------------------------------------------
left &&
---------------------------------------------------------------------------------
left |
---------------------------------------------------------------------------------
left ^
---------------------------------------------------------------------------------
left &
---------------------------------------------------------------------------------
non-associative == != ===
---------------------------------------------------------------------------------
non-associative < <= > >=
---------------------------------------------------------------------------------
left << >>
---------------------------------------------------------------------------------
left + - .
---------------------------------------------------------------------------------
left * / %
---------------------------------------------------------------------------------
right ! ~ ++ -- (int) (double) (string) (array) (object) @
---------------------------------------------------------------------------------
right [
---------------------------------------------------------------------------------
non-associative new
---------------------------------------------------------------------------------
출처 : http://qdata.co.kr/bo/bbs/board.php?bo_table=pht&wr_id=41
관련링크
댓글목록
등록된 댓글이 없습니다.