<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://trans.onionmixer.net/wiki/index.php?action=history&amp;feed=atom&amp;title=ComputerProgrammingwithGNUSmalltalk%3A4.2</id>
	<title>ComputerProgrammingwithGNUSmalltalk:4.2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://trans.onionmixer.net/wiki/index.php?action=history&amp;feed=atom&amp;title=ComputerProgrammingwithGNUSmalltalk%3A4.2"/>
	<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=ComputerProgrammingwithGNUSmalltalk:4.2&amp;action=history"/>
	<updated>2026-04-16T20:13:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://trans.onionmixer.net/wiki/index.php?title=ComputerProgrammingwithGNUSmalltalk:4.2&amp;diff=2513&amp;oldid=prev</id>
		<title>Onionmixer: CPGS 선택제어 페이지 추가</title>
		<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=ComputerProgrammingwithGNUSmalltalk:4.2&amp;diff=2513&amp;oldid=prev"/>
		<updated>2012-10-16T07:04:11Z</updated>

		<summary type="html">&lt;p&gt;CPGS 선택제어 페이지 추가&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==선택 제어==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ifTrue:===&lt;br /&gt;
&lt;br /&gt;
첫 선택 제어 메시지는 ifTrue: 입니다. 일반적인 구조는 다음과 같습니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;smalltalk&amp;quot;&amp;gt;&lt;br /&gt;
anObject ifTrue: [block-expression-1. block-expression-2]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Boolean 객체에 이 메시지가 전달되면, 객체가 true 일 때, 코드 블록 내의 표현을 실행하며, false일 때에는 무시합니다.&lt;br /&gt;
예를 들어보겠습니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;smalltalk&amp;quot;&amp;gt;&lt;br /&gt;
| ourVariable |&lt;br /&gt;
&lt;br /&gt;
ourVariable := true.&lt;br /&gt;
&lt;br /&gt;
ourVariable ifTrue: [&lt;br /&gt;
	&amp;#039;Our variable is true.&amp;#039; printNl.&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{HighlightPurple|&amp;#039;Our variable is true.&amp;#039;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ourVariable이라고 부르는 변수를 생성하고, true 객체를 지정합니다. 그 다음 ifTrue: 메시지를 보냅니다. ourVariable이 true로 지정되어 있기 때문에, 코드블록을 수행합니다.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{HighlightBoldBox|질문:&amp;lt;BR&amp;gt;ourVariable을 false 객체로 할당하고 같은 코드를 수행하여 보십시오.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ifFalse:===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ifFalse: 메시지는 그것이 false 객체에게 보내졌을 때 코드 블록을 수행하는 것을 제외하면 ifTrue:와 같습니다.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ifTrue:ifFalse:===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
이제 여러분의 객체가 참일 때 수행할 코드와 거짓일 때 수행할 코드에 대해 써 볼 시간입니다. 이 메시지는 여러분들에게 쉬운 방법을 제공합니다. 일반 구조를 보면 다음과 같습니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;smalltalk&amp;quot;&amp;gt;&lt;br /&gt;
anObject ifTrue: [block-expression-1. block-expression-2] ifFalse: [block-expression-3. block-expression-4]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
물론 더욱 보기 좋게 다음과 같이 쓴다고 하여도 문제 없습니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;smalltalk&amp;quot;&amp;gt;&lt;br /&gt;
an-object&lt;br /&gt;
	ifTrue: [&lt;br /&gt;
		the-code-block-to-execute&lt;br /&gt;
	] ifFalse: [&lt;br /&gt;
		the-code-block-to-execute&lt;br /&gt;
	]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
이제 ifTrue:ifFalse: 메시지를 사용하는 예를 하나 들어서 선택 제어 메시지를 끝낼까 합니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;smalltalk&amp;quot;&amp;gt;&lt;br /&gt;
| ourVariable |&lt;br /&gt;
&lt;br /&gt;
ourVariable := false.&lt;br /&gt;
&lt;br /&gt;
ourVariable ifTrue: [&lt;br /&gt;
	&amp;#039;Our variable is true.&amp;#039; printNl.&lt;br /&gt;
] ifFalse: [&lt;br /&gt;
	&amp;#039;Our variable is false.&amp;#039; printNl.&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{HighlightPurple|&amp;#039;Our variable is false.&amp;#039;}}&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:ComputerProgrammingwithGNUSmalltalk]]&lt;/div&gt;</summary>
		<author><name>Onionmixer</name></author>
	</entry>
</feed>