| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="ref.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="ref.html" title='Python Reference Manual' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="compound.html" /> |
| 13 | <link rel="prev" href="expressions.html" /> |
| 14 | <link rel="parent" href="ref.html" /> |
| 15 | <link rel="next" href="exprstmts.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>6. Simple statements </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="5.14 Summary" |
| 25 | href="summary.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="Python Reference Manual" |
| 28 | href="ref.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="6.1 Expression statements" |
| 31 | href="exprstmts.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Reference Manual</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><img src='../icons/blank.png' |
| 38 | border='0' height='32' alt='' width='32' /></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="summary.html">5.14 Summary</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="ref.html">Python Reference Manual</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="exprstmts.html">6.1 Expression statements</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION008000000000000000000"></A><A NAME="simple"></A> |
| 56 | <BR> |
| 57 | 6. Simple statements |
| 58 | </H1> |
| 59 | <a id='l2h-451' xml:id='l2h-451'></a> |
| 60 | <P> |
| 61 | Simple statements are comprised within a single logical line. |
| 62 | Several simple statements may occur on a single line separated |
| 63 | by semicolons. The syntax for simple statements is: |
| 64 | |
| 65 | <P> |
| 66 | <dl><dd class="grammar"> |
| 67 | <div class="productions"> |
| 68 | <table> |
| 69 | <tr> |
| 70 | <td><a id='tok-simple_stmt' xml:id='tok-simple_stmt'>simple_stmt</a></td> |
| 71 | <td>::=</td> |
| 72 | <td><a class='grammartoken' href="exprstmts.html#tok-expression_stmt">expression_stmt</a></td></tr> |
| 73 | <tr> |
| 74 | <td></td> |
| 75 | <td></td> |
| 76 | <td><code>| <a class='grammartoken' href="assert.html#tok-assert_stmt">assert_stmt</a></code></td></tr> |
| 77 | <tr> |
| 78 | <td></td> |
| 79 | <td></td> |
| 80 | <td><code>| <a class='grammartoken' href="assignment.html#tok-assignment_stmt">assignment_stmt</a></code></td></tr> |
| 81 | <tr> |
| 82 | <td></td> |
| 83 | <td></td> |
| 84 | <td><code>| <a class='grammartoken' href="augassign.html#tok-augmented_assignment_stmt">augmented_assignment_stmt</a></code></td></tr> |
| 85 | <tr> |
| 86 | <td></td> |
| 87 | <td></td> |
| 88 | <td><code>| <a class='grammartoken' href="pass.html#tok-pass_stmt">pass_stmt</a></code></td></tr> |
| 89 | <tr> |
| 90 | <td></td> |
| 91 | <td></td> |
| 92 | <td><code>| <a class='grammartoken' href="del.html#tok-del_stmt">del_stmt</a></code></td></tr> |
| 93 | <tr> |
| 94 | <td></td> |
| 95 | <td></td> |
| 96 | <td><code>| <a class='grammartoken' href="print.html#tok-print_stmt">print_stmt</a></code></td></tr> |
| 97 | <tr> |
| 98 | <td></td> |
| 99 | <td></td> |
| 100 | <td><code>| <a class='grammartoken' href="return.html#tok-return_stmt">return_stmt</a></code></td></tr> |
| 101 | <tr> |
| 102 | <td></td> |
| 103 | <td></td> |
| 104 | <td><code>| <a class='grammartoken' href="yield.html#tok-yield_stmt">yield_stmt</a></code></td></tr> |
| 105 | <tr> |
| 106 | <td></td> |
| 107 | <td></td> |
| 108 | <td><code>| <a class='grammartoken' href="raise.html#tok-raise_stmt">raise_stmt</a></code></td></tr> |
| 109 | <tr> |
| 110 | <td></td> |
| 111 | <td></td> |
| 112 | <td><code>| <a class='grammartoken' href="break.html#tok-break_stmt">break_stmt</a></code></td></tr> |
| 113 | <tr> |
| 114 | <td></td> |
| 115 | <td></td> |
| 116 | <td><code>| <a class='grammartoken' href="continue.html#tok-continue_stmt">continue_stmt</a></code></td></tr> |
| 117 | <tr> |
| 118 | <td></td> |
| 119 | <td></td> |
| 120 | <td><code>| <a class='grammartoken' href="import.html#tok-import_stmt">import_stmt</a></code></td></tr> |
| 121 | <tr> |
| 122 | <td></td> |
| 123 | <td></td> |
| 124 | <td><code>| <a class='grammartoken' href="global.html#tok-global_stmt">global_stmt</a></code></td></tr> |
| 125 | <tr> |
| 126 | <td></td> |
| 127 | <td></td> |
| 128 | <td><code>| <a class='grammartoken' href="exec.html#tok-exec_stmt">exec_stmt</a></code></td></tr> |
| 129 | </table> |
| 130 | </div> |
| 131 | <a class="grammar-footer" |
| 132 | href="grammar.txt" type="text/plain" |
| 133 | >Download entire grammar as text.</a> |
| 134 | </dd></dl> |
| 135 | |
| 136 | <P> |
| 137 | |
| 138 | <p><br /></p><hr class='online-navigation' /> |
| 139 | <div class='online-navigation'> |
| 140 | <!--Table of Child-Links--> |
| 141 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> |
| 142 | |
| 143 | <UL CLASS="ChildLinks"> |
| 144 | <LI><A href="exprstmts.html">6.1 Expression statements</a> |
| 145 | <LI><A href="assert.html">6.2 Assert statements</a> |
| 146 | <LI><A href="assignment.html">6.3 Assignment statements</a> |
| 147 | <UL> |
| 148 | <LI><A href="augassign.html">6.3.1 Augmented assignment statements</a> |
| 149 | </ul> |
| 150 | <LI><A href="pass.html">6.4 The <tt class="keyword">pass</tt> statement</a> |
| 151 | <LI><A href="del.html">6.5 The <tt class="keyword">del</tt> statement</a> |
| 152 | <LI><A href="print.html">6.6 The <tt class="keyword">print</tt> statement</a> |
| 153 | <LI><A href="return.html">6.7 The <tt class="keyword">return</tt> statement</a> |
| 154 | <LI><A href="yield.html">6.8 The <tt class="keyword">yield</tt> statement</a> |
| 155 | <LI><A href="raise.html">6.9 The <tt class="keyword">raise</tt> statement</a> |
| 156 | <LI><A href="break.html">6.10 The <tt class="keyword">break</tt> statement</a> |
| 157 | <LI><A href="continue.html">6.11 The <tt class="keyword">continue</tt> statement</a> |
| 158 | <LI><A href="import.html">6.12 The <tt class="keyword">import</tt> statement</a> |
| 159 | <UL> |
| 160 | <LI><A href="future.html">6.12.1 Future statements</a> |
| 161 | </ul> |
| 162 | <LI><A href="global.html">6.13 The <tt class="keyword">global</tt> statement</a> |
| 163 | <LI><A href="exec.html">6.14 The <tt class="keyword">exec</tt> statement</a> |
| 164 | </ul> |
| 165 | <!--End of Table of Child-Links--> |
| 166 | </div> |
| 167 | |
| 168 | <DIV CLASS="navigation"> |
| 169 | <div class='online-navigation'> |
| 170 | <p></p><hr /> |
| 171 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 172 | <tr> |
| 173 | <td class='online-navigation'><a rel="prev" title="5.14 Summary" |
| 174 | href="summary.html"><img src='../icons/previous.png' |
| 175 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 176 | <td class='online-navigation'><a rel="parent" title="Python Reference Manual" |
| 177 | href="ref.html"><img src='../icons/up.png' |
| 178 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 179 | <td class='online-navigation'><a rel="next" title="6.1 Expression statements" |
| 180 | href="exprstmts.html"><img src='../icons/next.png' |
| 181 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 182 | <td align="center" width="100%">Python Reference Manual</td> |
| 183 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 184 | href="contents.html"><img src='../icons/contents.png' |
| 185 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 186 | <td class='online-navigation'><img src='../icons/blank.png' |
| 187 | border='0' height='32' alt='' width='32' /></td> |
| 188 | <td class='online-navigation'><a rel="index" title="Index" |
| 189 | href="genindex.html"><img src='../icons/index.png' |
| 190 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 191 | </tr></table> |
| 192 | <div class='online-navigation'> |
| 193 | <b class="navlabel">Previous:</b> |
| 194 | <a class="sectref" rel="prev" href="summary.html">5.14 Summary</A> |
| 195 | <b class="navlabel">Up:</b> |
| 196 | <a class="sectref" rel="parent" href="ref.html">Python Reference Manual</A> |
| 197 | <b class="navlabel">Next:</b> |
| 198 | <a class="sectref" rel="next" href="exprstmts.html">6.1 Expression statements</A> |
| 199 | </div> |
| 200 | </div> |
| 201 | <hr /> |
| 202 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 203 | </DIV> |
| 204 | <!--End of Navigation Panel--> |
| 205 | <ADDRESS> |
| 206 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 207 | </ADDRESS> |
| 208 | </BODY> |
| 209 | </HTML> |