Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 2.7 KB

operators.md

File metadata and controls

65 lines (52 loc) · 2.7 KB

Operatörler

One'daki bir operatör, derleyiciye veya yorumlayıcıya belirli matematiksel, ilişkisel veya mantıksal işlemi gerçekleştirmesini ve nihai sonucu üretmesini söyleyen bir semboldür.

Örnek

int sum1 = 100 + 50;        // 150 (100 + 50)
int sum2 = sum1 + 250;      // 400 (150 + 250)
int sum3 = sum2 + sum2;     // 800 (400 + 400)

One operatörleri aşağıdaki gruplara ayırır:

  • Aritmetik operatörler
  • Atama operatörleri
  • Karşılaştırma operatörleri
  • Mantıksal operatörler
  • Bitwise (Bitsel) operatörleri

Aritmetik operatörler

Operator Name Description Example
+ Addition Adds together two values x + y
- Subtraction Subtracts one value from another x - y
* Multiplication Multiplies two values x * y
/ Division Divides one value by another x / y
% Modulus Returns the division remainder x % y
++ Increment Increases the value of a variable by 1 ++x
-- Decrement Decreases the value of a variable by 1 --x

Atama operatörleri

Operator Example Same As
= x = 5 x = 5
+= x += 3 x = x + 3
-= x -= 3 x = x - 3
*= x *= 3 x = x * 3
/= x /= 3 x = x / 3
%= x %= 3 x = x % 3
&= x &= 3 x = x & 3
^= x ^= 3 x = x ^ 3
>>= x >>= 3 x = x >> 3
<<= x <<= 3 x = x << 3

Karşılaştırma operatörleri

Operator Name Example
== Equal to x == y
!= Not equal x != y
> Greater than x > y
< Less than x < y
>= Greater than or equal to x >= y
<= Less than or equal to x <= y

Mantıksal operatörler

Operator Name Description Example
&& Logical and Returns true if both statements are true x < 5 && x < 10
|| Logical or Returns true if one or both statements are true x < 5 || x < 4
! Logical not Reverse the result, returns false if the result is true !(x < 5 && x < 10)