C#17 [C#]if와 else static void Main(string[] args) { int hp = 0; bool isDead = (hp 2021. 3. 31. [C#]데이터 마무리 namespace CSharp { class Program { static void Main(string[] args) { int a = 3 + ((2 * 3) ^ 4); // 우선 순위 // 1. ++ -- // 2. * / % // 3. + - // 4. > // 5. // 6. == != // 7. & // 8. ^ // 9. | // .. var num = 3; var num2 = "Hello World"; // 알아서 형 컴파일, 남용하지 말 것 } } } 2021. 3. 25. [C#]비트 연산 namespace CSharp { class Program { static void Main(string[] args) { int id = 123; int key = 401; int a = id ^ key; int b = a ^ key; // > &(and) |(or) ^(xor : 두 값이 다를 경우 1) ~(not : 바꿔치기) Console.WriteLine(a); Console.WriteLine(b); } } } 2021. 3. 25. [C#]데이터 연산 namespace CSharp { class Program { static void Main(string[] args) { int hp = 100; Console.WriteLine(hp++); // >= != == bool isAlive = (hp > 0); bool isHighLevel = (isHighLevel >= 40); // && AND || OR ! NOT // a = 살아있는 고렙 유저인가요? bool a = isAlive && isHighLevel; // b = 살아있거나, 고렙 유저이거나, 둘 중 하나인가요? bool b = isAlive || isHighLevel; //c = 죽은 유저인가요? bool c = !isAlive; } } } 2021. 3. 25. 이전 1 2 3 4 5 다음