Skip to content

Commit a2e9060

Browse files
committed
Exceptions
1 parent 6d6bdba commit a2e9060

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,8 @@ else:
13631363
finally:
13641364
<code_3>
13651365
```
1366+
* **Code inside the `'else'` block will only be executed if `'try'` block had no exception.**
1367+
* **Code inside the `'finally'` block will always be executed.**
13661368

13671369
### Catching Exceptions
13681370
```python

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,10 @@
13011301
&lt;code_3&gt;
13021302
</code></pre></div>
13031303

1304+
<ul>
1305+
<li><strong>Code inside the <code class="python hljs"><span class="hljs-string">'else'</span></code> block will only be executed if <code class="python hljs"><span class="hljs-string">'try'</span></code> block had no exception.</strong></li>
1306+
<li><strong>Code inside the <code class="python hljs"><span class="hljs-string">'finally'</span></code> block will always be executed.</strong></li>
1307+
</ul>
13041308
<div><h3 id="catchingexceptions">Catching Exceptions</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">except</span> &lt;exception&gt;:
13051309
<span class="hljs-keyword">except</span> &lt;exception&gt; <span class="hljs-keyword">as</span> &lt;name&gt;:
13061310
<span class="hljs-keyword">except</span> (&lt;exception&gt;, ...):

0 commit comments

Comments
 (0)