Difference between revisions of "Begin/zh CN"

From Lazarus wiki
Jump to navigationJump to search
m (Reverted edits by Pipi (Talk); changed back to last version by Kingfree)
m (Text replace - "delphi>" to "syntaxhighlight>")
Line 3: Line 3:
 
对于一个函数,方法(method)、过程(procedure)、程序(program)、属性(property),它总是用于[[Const|const]]、[[Type|type]]以及[[Var|var]]之后,在第一个可执行语句之前。它必须伴随[[End|end]]同时出现:
 
对于一个函数,方法(method)、过程(procedure)、程序(program)、属性(property),它总是用于[[Const|const]]、[[Type|type]]以及[[Var|var]]之后,在第一个可执行语句之前。它必须伴随[[End|end]]同时出现:
  
<delphi>
+
<syntaxhighlight>
 
   program Project1;
 
   program Project1;
 
   var (..);
 
   var (..);
Line 9: Line 9:
 
     (..);
 
     (..);
 
   end.
 
   end.
</delphi>
+
</syntaxhighlight>
  
 
对于块标记,此关键字用于开头,同样也必须标明结束:
 
对于块标记,此关键字用于开头,同样也必须标明结束:
  
<delphi>
+
<syntaxhighlight>
 
   if (..) then
 
   if (..) then
 
     begin
 
     begin
Line 22: Line 22:
 
       (..)
 
       (..)
 
     end;
 
     end;
</delphi>
+
</syntaxhighlight>
  
 
一个'''begin''' ''必须''对应一个'''[[End|end]]'''。
 
一个'''begin''' ''必须''对应一个'''[[End|end]]'''。
  
 
{{Keywords}}
 
{{Keywords}}

Revision as of 14:56, 24 March 2012

关键字 keyword begin 用于标明函数对象属性过程程序property等的开始, 也可以用于程序块的开始。

对于一个函数,方法(method)、过程(procedure)、程序(program)、属性(property),它总是用于consttype以及var之后,在第一个可执行语句之前。它必须伴随end同时出现:

  program Project1;
  var (..);
  begin
    (..);
  end.

对于块标记,此关键字用于开头,同样也必须标明结束:

  if (..) then
    begin
      (..)
    end
  else
    begin
      (..)
    end;

一个begin 必须对应一个end


Keywords: begindoelseendforifrepeatthenuntilwhile