Programming

Major Tools of Programming

Every programming language has a handful of tools to work with.

Conditionals

Conditionals are "if" statements that will execute code if the certain conditions are met. In our fractal tree, we used a conditional to stop the code form executing after the level reached zero.

For example, the if statement above tells the program that if the turtles' energy is less than or equal to zero, the turtle will die.


Loops

Loops make a code repeat itself.


Variables

Variables are letters or symbols that represent a value.


Functions

Functions organize code and can be inside another function.


Comments

For every computer language, there is a specific way to comment inside your code. For NetLogo, you use two semicolons before your comment. On the other hand, you would comment in HTML with "< !--" to start it and end it with "-->."


Programming Languages

A programming language is a way to communicate with computers. There are many type of programming languages and these are some that we have learned about.


NetLogo

First, we learned to program turtles in Logo programming language. We were able to make the turtles draw things from simple polygons to fractal trees.

The next day, we learned how to use ticks and conditionals to create a turtle simulation where they move, eat, reproduce, and die depending on their energy levels.


Python

In Python, we learned how to use the major tools of programming. It's not pictured, but we need to use a hash tag for commenting. We learned how to use Python to calculate algebraic equations.

In the pictures above, the program is on the right and the code for it is on the left. We used conditionals to determine what would happen if certain phrases were entered. We defined several variables to add in our conditionals.

We also used Python to program our robots to perform certain functions.


HTML

HTML is not a programming language, but rather a markup language. This means that it just annotates a document. HTML is not a programming language because it's not necessarily instructing a computer to perform a task.

To create this website, we used HTML and added on to this website at the end of every day. As Expeditions progresses, we use more and more HTML for our websites.

When using HTML, you have a starting and ending tag. The tag would have a slash to indicate that that is the end of the tag. Attributes are extra information that go in the opening tag.

In this bit of code, the "center" tag goes before and after the content. To add more than one set of tags to content, they would have to be organized in a certain way. The "h1" tag would end before the "center" tag because it started after it. Think of it as putting on more and more shirts over yourself.

Now focusing on that font face part, the "font" would be the tag and the "face" would be the attribute. This attribute is adding more information about the font. The attribute is saying that the phrase "Major Tools of Programming" has to be in Trebuchet MS font.

The "p" tag just indicates that defines the content as a paragraph.


CSS

I also learned how to use "div" tags to wrap around certain elements and apply CSS to the content inside. For the CSS, I put it in the same file as the HTML and used the "style" tag to indicate that the content inside is CSS and not HTML.

This code shows the formatting on the side bar of this page. I wrapped everything in a container and then wrapped all the information that I've learned inside the container. I made a separate "div" tag for the side bar to made it easier to format. The picture doesn't show the ending tag for the "style" tag because I added some more CSS for other elements, like that panda image in the corner.