#
msgid ""
msgstr ""
"Project-Id-Version: Modelica by Example 0.2.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-04-14 10:14-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../../source/behavior/functions/control_flow.rst:4
msgid "Control Flow"
msgstr "控制流程"

#: ../../source/behavior/functions/control_flow.rst:6
msgid ""
"In some cases, a function is simply a fixed set of step by step "
"calculations.  But in other cases, some kind of looping or iteration is "
"required.  In this section, we'll cover the different control structures "
"that are allowed within a function definition."
msgstr ""
"某些情况下，函数只是按照固定的流程一步一步地进行计算。\ "
"但是在其他一些情况下，函数也需要某种循环或迭代。\ "
"在本节里，我们将讨论函数定义内所支持的不同控制结构。\ "

#: ../../source/behavior/functions/control_flow.rst:12
msgid "Branching"
msgstr "分支结构"

#: ../../source/behavior/functions/control_flow.rst:14
msgid ""
"We've already seen use cases involving ``if`` statements and expressions.  "
"These are, of course, allowed inside functions as well. In fact, in an "
"``equation`` section there is a restriction on ``if`` statements that each "
"branch of the ``if`` statement (*i.e.,* under all conditions) generate the "
"same number of equations.  But that restriction does not apply in an "
"``algorithm`` section (*e.g.,* in a function definition)."
msgstr ""
"在前面章节，我们已经看到了涉及\ ``if``\ 语句和\ ``if``\ 表达式的例子。\ "
"函数内部自然也可以包含这些元素。\ "
"实际上，\ ``equation``\ 区域对\ ``if``\ 语句有一定的限制。\ "
"那就是，\ ``if``\ 语句的每个分支（即所有可能条件）均必须生成相同数量的方程。\ "
"但是，上述限制对\ ``algorithm``\ 区域并不适用（例如在函数定义时）。\ "

#: ../../source/behavior/functions/control_flow.rst:23
msgid "Looping"
msgstr "循环"

#: ../../source/behavior/functions/control_flow.rst:28
msgid ""
"In an ``equation`` section, looping is (just like with branching) restricted"
" to ensure that the number of equations generated is the same regardless of "
"the state of the system.  For this reason, the only looping construct "
"allowed in an ``equation`` section (and, therefore, the only one we have "
"discussed up until now) is the ``for`` loop."
msgstr ""
"\ ``equation``\ 区域要确保在任意系统状态下生成的方程数量相等。\ "
"所以，循环（就像分支一样）在使用时受到了严格限制。\ "
"出于这个原因，\ ``equation``\ 区域（目前为止，我们唯一讨论过的区域）唯一允许使用的循环结构是\ ``for``\ 循环。\ "

#: ../../source/behavior/functions/control_flow.rst:34
msgid ""
"The syntax of a ``for`` loop is the same in a function as it is in any other"
" context.  It identifies an iteration variable and then assigns that "
"iteration variable a set of values contained in a vector, *e.g.,*"
msgstr ""
"在函数定义中，\ ``for``\ 循环的语法与其在其他情况下完全一样。\ "
"使用\ ``for``\ "
"循环首先要确定循环变量。\ "
"然后循环将数组中的数值分配给循环变量，即："

#: ../../source/behavior/functions/control_flow.rst:45
msgid ""
"There two main differences between an ``equation`` section and an "
"``algorithm`` section is that an ``algorithm`` section uses explicit "
"assignment statements instead of equations and, since there are no "
"equations, there are no concerns about generating a specified number of "
"equations when using ``if`` or ``for``."
msgstr ""
"\ ``equation``\ 区域与\ ``algorithm``\ 区域有两个主要的区别。\ "
"这分别是：\ ``algorithm``\ "
"区域使用显式赋值语句而不使用等式；因此在使用\ ``if``\ 语句或\ ``for``\ 语句时就不需要考虑生成方程的数量。\ "

#: ../../source/behavior/functions/control_flow.rst:54
msgid ""
"In addition, an ``algorithm`` section allows us the opportunity to be more "
"flexible by permitting the use of ``while`` loops as well.  A ``while`` loop"
" is not permitted in an ``equation`` section because, by its very nature, "
"the number of iterations (and, therefore, the number of equations created in"
" an ``equation`` section) is unpredictable. But this unpredictability is not"
" an issue in an ``algorithm`` section."
msgstr ""
"此外，\ ``algorithm``\ 区域允许\ ``while``\ 循环的使用。\ "
"这让我们能更灵活地进行建模。\ "
"\ ``equation``\ 区域不允许使用\ ``while``\ 循环的原因在于，\ "
"其在本质上生成的方程数量（即\ ``equation``\ 区域生成的方程数量）是不可预测的。\ "
"但是，这种不可预见性对于\ ``algorithm``\ 区域并没有什么影响。\ "

#: ../../source/behavior/functions/control_flow.rst:61
msgid ""
"As we already saw in the ``InterpolateVector`` function from our previous "
"discussion of :ref:`Interpolation`, the syntax for a ``while`` loop is:"
msgstr ""
"在前面章节\ :ref:`Interpolation`\ 中，我们已经讨论了\ ``InterpolateVector``\ 函数。\ "
"其包含的\ ``while``\ 循环的语法如下所示："

#: ../../source/behavior/functions/control_flow.rst:69
msgid ""
"The main elements of the ``while`` loop are the condition expression that "
"determines whether to continue looping and the statements within the "
"``while`` loop."
msgstr "\ ``while``\ 循环的主要元素是一系列条件表达式。\ "
"其作用在于决定是否继续执行\ ``while``\ 循环内的语句。\ "

#: ../../source/behavior/functions/control_flow.rst:74
msgid "``break`` and ``return``"
msgstr "\ ``break``\ 以及\ ``return``\ "

#: ../../source/behavior/functions/control_flow.rst:78
msgid ""
"When iterating, it is sometimes necessary to terminate the iterations "
"prematurely.  For example, in a ``for`` loop, the number of iterations is "
"normally determined by the vector of values being iterated over.  But there "
"are cases where subsequent iterations are unnecessary.  Similarly, in a "
"``while`` loop, it may be convenient to have a check within the ``while`` "
"loop that indicates when to terminate.  In these cases, a ``break`` "
"statement can be used to terminate the innermost loop."
msgstr ""
"在进行循环时，某些时候需要提前结束循环过程。\ "
"例如，在\ ``for``\ "
"循环中，循环重复的次数通常是由循环数组的大小来决定的。\ "
"但在某些情况下，后续的循环过程是没有必要的。\ "
"同样的，在\ ``while``\ "
"循环中，它可以方便的检查\ ``while``\ 循环何时终止。\ "
"在这类情况下，可以使用\ ``break``\ 语句终止最内层循环。\ "

#: ../../source/behavior/functions/control_flow.rst:89
msgid ""
"Another issue of control flow involves when to terminate and exit from the "
"``algorithm`` section itself.  There are many circumstances in which all the"
" ``output`` variables have been assigned their final values.  While it is "
"always true that ``if`` and ``else`` statements can be used to prevent any "
"further calculations and assignments, it is often more readable to simply "
"indicate clearly that no further calculations are needed.  In such cases, "
"the ``return`` statement can be used to terminate any further processing "
"within a function's ``algorithm`` section.  When a ``return`` statement is "
"encountered, whatever values are currently associated with the ``output`` "
"variables are the ones that will be returned."
msgstr ""
"控制流程的另一个问题是何时终止并从\ ``algorithm``\ 区域本身退出。\ "
"在很多情况下，所有的\ ``output``\ "
"变量都被分配了它们的最终值。\ "
"纵然，我们总可以使用\ ``if``\ 和\ ``else``\ "
"语句禁止变量的进一步计算和赋值。\ "
"但若能直接表明无须进行进一步计算，那就简明和清晰了。\ "
"这时，我们可以在函数的\ ``algorithm``\ "
"区域使用\ ``return``\ 语句终止所有方程的进一步运算。\ "
"在执行\ ``return``\ 语句时，\ ``output``\ "
"变量将返回当前时刻与之相关联的变量值。\ "
