<?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=StartprogrammingusingObjectPascal%3ARaiseAnException</id>
	<title>StartprogrammingusingObjectPascal:RaiseAnException - 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=StartprogrammingusingObjectPascal%3ARaiseAnException"/>
	<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=StartprogrammingusingObjectPascal:RaiseAnException&amp;action=history"/>
	<updated>2026-05-01T07:50:17Z</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=StartprogrammingusingObjectPascal:RaiseAnException&amp;diff=291&amp;oldid=prev</id>
		<title>Onionmixer: 번역수정</title>
		<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=StartprogrammingusingObjectPascal:RaiseAnException&amp;diff=291&amp;oldid=prev"/>
		<updated>2013-04-04T10:57:49Z</updated>

		<summary type="html">&lt;p&gt;번역수정&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;
때로는 논리 오류를 막기 위해 예외를 만들고 발생시킬 필요가 있습니다. 예를 들어 사용자가 월의 숫자를 13 으로 입력 했다면, 월에 해당하는 숫자의 범위를 벗어났다는 것을 알리는 예외를 발생시킬 수 있습니다.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
예제:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
Program RaiseExcept;&lt;br /&gt;
&lt;br /&gt;
{$mode objfpc}{$H+}&lt;br /&gt;
&lt;br /&gt;
uses&lt;br /&gt;
    {$IFDEF UNIX}{$IFDEF UseCThreads}&lt;br /&gt;
    cthreads,&lt;br /&gt;
    {$ENDIF}{$ENDIF}&lt;br /&gt;
    Classes, SysUtils&lt;br /&gt;
    { you can add units after this };&lt;br /&gt;
&lt;br /&gt;
var&lt;br /&gt;
    x: Integer;&lt;br /&gt;
begin&lt;br /&gt;
    Write(&amp;#039;Please input a number from 1 to 10: &amp;#039;);&lt;br /&gt;
    Readln(x);&lt;br /&gt;
    try&lt;br /&gt;
&lt;br /&gt;
        if ( x &amp;lt; 1 ) or ( x &amp;gt; 10 ) then // raise exception&lt;br /&gt;
            raise exception.Create(‘x is out of range’);&lt;br /&gt;
        Writeln(‘ X * 10 = ‘,  x * 10);&lt;br /&gt;
&lt;br /&gt;
    except&lt;br /&gt;
    on e: exception do   // catch my exception    begin&lt;br /&gt;
        Writeln(&amp;#039;Error: &amp;#039; + e.Message);&lt;br /&gt;
    end;&lt;br /&gt;
    end;&lt;br /&gt;
    Write(&amp;#039;Press enter to close&amp;#039;);&lt;br /&gt;
    Readln;&lt;br /&gt;
&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
사용자가 1 부터 10 사이를 벗어나는 범위 밖의 값을 입력하면, 예외(&amp;#039;&amp;#039;X is out of range&amp;#039;&amp;#039;)가 만들어질 것이고 이 부분에서 예외 처리가 없다면, 프로그램은 문제에 충돌할 것입니다. 왜냐하면 try except 사이에 raise 키워드를 포함한 코드를 작성했고, 프로그램은 충돌하지 않겠지만, 대신 오류 메시지를 표시할 것이기 때문입니다.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:StartprogrammingusingObjectPascal]]&lt;/div&gt;</summary>
		<author><name>Onionmixer</name></author>
	</entry>
	<entry>
		<id>https://trans.onionmixer.net/wiki/index.php?title=StartprogrammingusingObjectPascal:RaiseAnException&amp;diff=289&amp;oldid=prev</id>
		<title>Onionmixer: SPOP 예외일으키기 페이지 추가</title>
		<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=StartprogrammingusingObjectPascal:RaiseAnException&amp;diff=289&amp;oldid=prev"/>
		<updated>2012-07-26T10:19:09Z</updated>

		<summary type="html">&lt;p&gt;SPOP 예외일으키기 페이지 추가&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;
때로는 논리 오류를 막기 위해 예외를 만들고 일으킬 필요가 있습니다. 예를 들어 사용자가 월 수를 13으로 입력 했다면, 월 수의 범위를 벗어났다는 것을 알리는 예외를 일으킬 수 있습니다.&lt;br /&gt;
&lt;br /&gt;
예제:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
Program RaiseExcept;&lt;br /&gt;
&lt;br /&gt;
{$mode objfpc}{$H+}&lt;br /&gt;
&lt;br /&gt;
uses&lt;br /&gt;
    {$IFDEF UNIX}{$IFDEF UseCThreads}&lt;br /&gt;
    cthreads,&lt;br /&gt;
    {$ENDIF}{$ENDIF}&lt;br /&gt;
    Classes, SysUtils&lt;br /&gt;
    { you can add units after this };&lt;br /&gt;
&lt;br /&gt;
var&lt;br /&gt;
    x: Integer;&lt;br /&gt;
begin&lt;br /&gt;
    Write(&amp;#039;Please input a number from 1 to 10: &amp;#039;);&lt;br /&gt;
    Readln(x);&lt;br /&gt;
    try&lt;br /&gt;
&lt;br /&gt;
        if ( x &amp;lt; 1 ) or ( x &amp;gt; 10 ) then // raise exception&lt;br /&gt;
            raise exception.Create(‘x is out of range’);&lt;br /&gt;
        Writeln(‘ X * 10 = ‘,  x * 10);&lt;br /&gt;
&lt;br /&gt;
    except&lt;br /&gt;
    on e: exception do   // catch my exception    begin&lt;br /&gt;
        Writeln(&amp;#039;Error: &amp;#039; + e.Message);&lt;br /&gt;
    end;&lt;br /&gt;
    end;&lt;br /&gt;
    Write(&amp;#039;Press enter to close&amp;#039;);&lt;br /&gt;
    Readln;&lt;br /&gt;
&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
사용자가 1부터 10까지의 범위 밖의 값을 입력하면, 예외(X is out of range)가 만들어질 것이고 이 부분에서 예외 처리가 없다면, 프로그램은 문제에 충돌할 것입니다. 왜냐 하면 try except 사이에 raise 키워드를 포함한 코드를 작성했고, 프로그램은 충돌하지 않겠지만, 대신 오류 메시지를 표시할 것이기 때문입니다.&lt;br /&gt;
[[Category:StartprogrammingusingObjectPascal]]&lt;/div&gt;</summary>
		<author><name>Onionmixer</name></author>
	</entry>
</feed>