What is coming?
Kris Jordan explaining how git works.
We will study boss statements, which are grammatically incomplete clauses that alter the flow of a program's control. So far, the programs we can write have steps that run in seriatum. We will now break this.
Every Python statement you have seen so far is a grammatically complete sentence. Here are two examples.
x = 5 Make x point a 5. 5 + 6 Evaluate 5 + 6
Now check this out.
Conditional Logic
if x == 5: if x equals 5, This is a boss statement Boss statements end in a colon. Here we give the boss statement a block of code and it becomes a complete sentence. Conditional logic has several boss statements. if x == 5: print("x is five.") This is a block.
Functions This is a function. It's how we remember a procedure under a name. The return keyword specifies the function's output.
def f(x): To define f(x), return x*x print(f(6))
Iteration This is a loop. It continues to execute as long as x does not equal 2.
while(x != 2): print("......") x += 1
In this next chapter we will learn how to use these tools and we become turing-complte, capable of solving any computing problem given enough time and memory.