Pre-lecture


Codework.

Mezangelle - Mez Breeze

Code As Object - Lecture 3

Coding Concepts II

Variable Exercises!

We're going to do a couple things in our IDEs to experiment with using variables.

Do I need to define IDE?

Control Structures

Every line of code is either performing an arithmetic operation or directing how your code is executed. The lines of code that affect how your code is executed are called control structures

Control Structures

Conditional Statements

Loops

Conditional Statements!

Arithmetic Operators

+ - * / %

Python: ** and //

Comparison Operators

==
!=
>
<
>=
<=

Boolean or Logical Operators

Let's do some coding.

Loops!

What is a loop?

No really, what, in your experience, is a loop?

A common loop mistake.

The loops that we're about to talk about happen in their entirety every time they are executed. So, for instance, if I wanted something to happen incrementally over the course of an animation, a loop would not be the way to do that.

We'll look at an example after we learn loop syntax.

While

A while loop continues to loop as long as its condition evaluates to true.

For for?

In Processing and p5.js, for loops are a special kind of while loop that has a control structure built into the syntax.

In Python, for loops are special loops that iterate over a list.

Let's look at for loops in each language

For loops in Processing and p5.js

For loops in Python

I ran out of time while making my slides. Let's look at the reference page for for loops in Processing's Python mode.

End of Lecture.