ECS1 at Tech Em

Joe Seiler, 2016-03-03, Classes

hopscotch, variables

Intro to Elementary Computer Science

What we went over: Variables/values

In terms of math, we defined a variable to be a quantity that is able to assume different numerical values.Variables store values so we can use them multiple times.


What apps we used in class: Hopscotch


Exercise we completed in Hopscotch:

To explore how to use values within variables, we programmed our character, a text object (your name) to make a square using a loop (from our first Hopscotch challenge last week).

We assigned a value (which is constant, this way we can use it more than once) as "X", some of you chose your name or other word for the value.

We set our value to display a number, "1."

We then used the value we created to set our text object as that value ("X"). Our text object was now displaying the number 1 as it performed the sequence of instructions to make a square.

To have our value continuously count up, we input 'Increase value' to be a part of our square instructions. We set it to increase our value "X" by 1.

Now, when we played our square instructions, each time your object turned to make the corner of the square, that number value increased by 1!

If you had your loop repeat 100 times or forever (endless loop), the object would increase its value by 1 until it reached 100 or it would keep counting up to infinity!


Link to a simliar exercise we did to showcase variable usage in Hopscotch app



Terms:

A Variable a quantity that is able to assume different numerical values.

Value remains constant.

Loop a sequence of instructions that is repeated until it recieves the order to stop.


Next class we will recap on logic gates and learn how we can combine them to form adders!


See you next class, March 21st!