How to create block statement in Python

Indent to create block statement

Python uses indenting to mark a block of code. A block of code is a group of statement which will execute together.

The indent must have the same amount of spaces or tabs. The following pseudocode illustrates what is code block.


this is a line of code
this is another line of code
this is the third line of code:
   this is a line of code inside the block
   another line in the block/*from  ww w .  java2  s. c o m*/
   third line in the code block
went out of the code block

From the code above we can see that the : indicates that the code block is about to begin.





















Home »
  Python »
    Language Basics »




Python Basics
Operator
Statements
Function Definition
Class
Buildin Functions
Buildin Modules