포스트

(C#) 2. 데이터 연산

Data Operation with C#

#

  • 최초 작성일: 2021년 3월 21일(월)

##

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;

namespace DataOperation
{
    class Program
    {
        static void Main(string[] args)
        {
            int hp = 100;
            int level = 50;

            // < <= > >= == !=
            bool isAlive = (hp > 0);
            bool isHighLevel = (level >= 40);

            // %% AND   || OR   ! NOT
            // a = 살아있는 고랩 유저인가?
            bool a = isAlive && isHighLevel;

            // b = 살아있거나, 고렙 유저이거나, 둘 중 하나인가요?
            bool b = isAlive || isHighLevel;

            // c = 죽은 유저인가?
            bool c = !isAlive;
        }
    }
}

이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.