Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 1/Constants/ko: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Basic Pascal Tutorial/Chapter 1/Constants/ko

OldNewLine
1+1C - 상수 (저자: Tao Yue, 상태: 변경없음)
2+
3+상수란 식별자에 의해 참조되며, 프로그램이 시작될 때 하나의 값을 할당받을 수 있다. 그 값은 상수로 저장이 되며, 값이 변경될 수 없다.
4+
5+상수는 프로그램의 상수 정의 부분에서 정의된다.
6+
7+``` pascal
8+const
9+ Identifier1 = value;
10+ Identifier2 = value;
11+ Identifier3 = value;
12+```
13+
14+예를 들어, 이제 한번 strings, characters, integers, reals, 그리고 Booleans 등의 다양한 형의 상수를 지정해 보자. 이 데이터 형에 대해서는 나중에 설명하겠다.
15+
16+``` pascal
17+const
18+ Name = 'Tao Yue';
19+ FirstLetter = 'a';
20+ Year = 1997;
21+ pi = 3.1415926535897932;
22+ UsingNCSAMosaic = TRUE;
23+```
24+
25+파스칼에선 문자를 감쌀 때, 작은 따옴표 (')를 사용한다는 것을 기억해야 한다! 이는 최신의 언어들이 큰 따옴표 (")나 Heredoc 표시법을 허용하는 것과 다른 것이다. 표준 파스칼은 큰 따옴표를 이용해 문자나 문자열을 표시하는 것을 허용하지 않는다.
26+
27+상수는 향후 바뀔 가능성은 있지만, 프로그램 전체에 걸쳐 사용될 값을 정의하는데 유용하다. 매번 값을 바꾸는 대신에, 상수의 정의 부분만 변경하면 되기 때문이다.
28+
29+데이터 형을 지정한 상수는 특정한 데이터 형을 갖는다. 예를 들자면,
30+
31+``` pascal
32+const
33+ a : real = 12;
34+```
35+
36+이 표현은 a 라는 상수는 integer형의 값인 12가 아닌 real 값의 12.0을 갖게 된다.
37+
38+| | | |
39+|----|----|----|
40+| [[Basic Pascal Tutorial/Chapter 1/Identifiers/ko|previous]] | [[Basic Pascal Tutorial/Contents/ko|contents]] | [[Basic Pascal Tutorial/Chapter 1/Variables and Data Types/ko|next]] |
41+
42+---
43+*From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 1/Constants/ko", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history