{"id":418,"date":"2026-08-13T03:09:52","date_gmt":"2026-08-13T08:09:52","guid":{"rendered":"https:\/\/sts.doit.wisc.edu\/training-materials\/?post_type=manual&#038;p=418"},"modified":"2026-08-13T03:09:53","modified_gmt":"2026-08-13T08:09:53","slug":"a-beginners-guide-to-programming","status":"publish","type":"manual","link":"https:\/\/sts.doit.wisc.edu\/training-materials\/manual\/a-beginners-guide-to-programming\/","title":{"rendered":"A Beginner&#8217;s Guide to Programming"},"content":{"rendered":"\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">As we write essays on our laptops and snap friends with our smartphones, it&#8217;s easy to forget how complicated these devices really are. A modern smartphone has more billions of transistors, along with light sensors, infrared cameras, gyroscopes, accelerometers, microphones, antennas, and tons of other technological components that let it do all the things we can use smartphones for.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How are we able to operate these complicated machines without needing an in-depth understanding of electrical engineering, abstract mathematics, digital signal processing, and all the other complexities involved?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Simple:&nbsp;<strong>programming<\/strong>!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks to engineers and software developers applying different kinds of programming at varying levels of complexity, we are able to use polished, human-friendly interfaces to control unbelievably sophisticated systems, without having to worry about how it is all accomplished.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But what exactly&nbsp;<em>is<\/em>&nbsp;programming? And what do you need to know if you want to learn to program\/code?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This manual will explain what programming is, explore some concepts that are common to most programming languages, and give real-world examples of how programming and coding are used today.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\">The terms&nbsp;<em>programming<\/em>&nbsp;and&nbsp;<em>coding<\/em>&nbsp;are both used when talking about writing instructions for computers. Opinions differ on whether they can be used interchangeably.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some people consider coding to be one aspect of programming, the way&nbsp;<em>frying<\/em>&nbsp;is one aspect of&nbsp;<em>cooking<\/em>. Other people consider them to be identical.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;ll mostly use the term programming throughout this manual, but we may call it coding here and there. It&#8217;s not that important what you call it, as long as you understand the concepts, and honestly, the people who make it a big deal probably have some other things going on they need to work through.<\/p>\n<\/div>\n<\/section>\n\n\n\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">What Does &#8220;Programming&#8221; Even Mean?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s easy to think of programming as an arcane, hard-to-understand skill that only highly trained people can perform. But programming just means <em>writing step-by-step instructions for how to accomplish a task, using language that a computer can understand.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Even though it can feel extremely complicated, when you break it down, programming really consists of just three simple actions, combined in different ways:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-b4b75a54 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<ol class=\"wp-block-list\">\n<li>Getting information from somewhere<\/li>\n\n\n\n<li>Doing something to the information (aka Processing it)<\/li>\n\n\n\n<li>Putting information somewhere<\/li>\n<\/ol>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">There are countless ways to combine and execute them, but fundamentally, all programming is just different combinations of those three steps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These steps are written out in special code that a computer can interpret, and the finished product is called a computer program.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading\">Computer Programming<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A&nbsp;<em>computer program<\/em>&nbsp;is any collection of code that has been written to instruct a computer how to do something. Computer programs go by many names, including scripts, applications\/apps, algorithms, and more.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Anything from a simple 1-line script to a professional application containing millions of lines of code can be considered a program.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Computer programs have&nbsp;<strong>data&nbsp;<\/strong>and&nbsp;<strong>behavior<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Data<\/strong>&nbsp;is <em>the information the program has access to while running.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Behavior<\/strong>&nbsp;is <em>what the program does with the data it has access to<\/em>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Getting Information<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For a computer program to do anything useful, it usually requires some amount of&nbsp;<em>data<\/em>, or information to work with.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This information can come from a variety of places:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-b4b75a54 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<ul class=\"wp-block-list\">\n<li>User input<\/li>\n\n\n\n<li>A file stored on the device<\/li>\n\n\n\n<li>Another computer over a network<\/li>\n\n\n\n<li>An on-device sensor like a camera or microphone<\/li>\n\n\n\n<li>A connected device (lab equipment, musical gear, smart home accessories, etc.)<\/li>\n\n\n\n<li>The programmer, written into the code itself<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The information itself can take many forms:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-b4b75a54 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<ul class=\"wp-block-list\">\n<li>Simple text<\/li>\n\n\n\n<li>Structured data like spreadsheets or database entries<\/li>\n\n\n\n<li>Digital media (photos, video, audio, etc.)<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The only requirement is that it is in (or can be converted into) a format the computer can understand: <em>1s and 0s.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Processing Information<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Manipulating or processing data makes up the majority of the&nbsp;<em>behavior<\/em>&nbsp;of most computer programs. Writing the instructions for this behavior is often what people have in mind when they thing of &#8216;computer programming&#8217;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Computers can perform data-related operations millions or billions of times faster than a human, with extreme precision. This makes them great at repetitive or calculation-intensive tasks like counting\/math, quickly finding specific items in large amounts of data, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All of these tasks involve the computer looking at information and doing something to it according to the instructions given to it by the programmer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Fast, accurate processing of information is what makes computers useful.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Putting Information Somewhere<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once we&#8217;ve given the computer some information and done something to it, it&#8217;s not especially useful until we get it out of the computer memory and put it somewhere else.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As with getting the information, there are a lot of places for a computers to output information it has processed:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-b4b75a54 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<ul class=\"wp-block-list\">\n<li>A screen or display<\/li>\n\n\n\n<li>A file in the computer&#8217;s local storage<\/li>\n\n\n\n<li>Physical output devices like printers<\/li>\n\n\n\n<li>Another computer over a network<\/li>\n\n\n\n<li>A connected device such as a speaker or medical\/lab equipment<\/li>\n\n\n\n<li>Automated machinery<\/li>\n\n\n\n<li>The input of another program<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Everything we do with computers is the result of programmers combining those three steps &#8211; getting, processing, and outputting information &#8211; in different ways.<\/p>\n<\/section>\n\n\n\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">Computers, Data, and Abstraction<\/h2>\n\n\n\n<div class=\"wp-block-group sts-callout-important has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\">The following section offers background technical knowledge if you are curious about the bigger picture of programming, but&nbsp;<em>this information is NOT a prerequisite to learn how to code<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>It is not necessary to know the technical details of how computers work if you want to be a programmer.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They can be helpful if you get into particularly complex or high-performance programming, but you can absolutely succeed as a coder without knowing what a transistor is or how binary code works.<\/p>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">What is a computer, and what does it compute?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">At its most basic, a computer is a machine that can process&nbsp;<em>information<\/em>&nbsp;using&nbsp;<em>logic<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In our everyday usage of the term,&nbsp;<em>information<\/em>&nbsp;can mean a lot of things. In this context,&nbsp;<strong>information is that which can be communicated about the state of something<\/strong>. The most basic building block of information is a&nbsp;<em>binary state<\/em>, or choice between two things: yes-no, true-false, on-off.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As we use it,&nbsp;<strong>logic is the process of using simple comparisons to evaluate how pieces of information relate to each other<\/strong>, specifically, using true-false comparisons to determine the output from a given set of inputs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By using basic logical comparisons to evaluate simple pieces of information, you can quickly start to represent much more complicated information.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In a computer, these logical comparisons are achieved with&nbsp;<em>circuits<\/em>. Circuits are electrical systems &#8211; tiny wires and switches &#8211; that allow electricity to flow along a given path. The electricity&#8217;s path changes based on different conditions (like whether a given switch is on or off), and that path allows for those simple logical comparisons to be made, which can be used to represent and process more complicated information.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A computer processor is basically just lots and lots of circuits working together in specific ways, extremely quickly. The information they process comes in the form of&nbsp;<em>bits<\/em>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Bits<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The fundamental unit of information is called a&nbsp;<strong>bit<\/strong>, which is short for&nbsp;<em>binary digit<\/em>.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading has-text-align-left\">Bit<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A bit, which is short for&nbsp;<em>binary digit<\/em>, is a unit of information that can be in one of two states (on\/off, true\/false, 0\/1, etc.).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is the fundamental building block of computing and is the basis of binary code, which is how computers read and interact with information.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Any object that can be in two different states can be used to represent this unit of information:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-b4b75a54 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<ul class=\"wp-block-list\">\n<li>A light switch being on or off<\/li>\n\n\n\n<li>A torch being lit or unlit<\/li>\n\n\n\n<li>A coin being heads or tails<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">People have even created functional computing devices inside the game Minecraft using an in-game substance called redstone, which can be turned on or off by changing certain items in the game.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In computers, this unit of information is represented using electrical devices called&nbsp;<em>transistors<\/em>. A transistor is a small electronic on-off switch that turns on or off depending on how much electricity is flowing through it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This on\/off state of the transistor represent a&nbsp;<em>bit<\/em>, and by setting up banks of multiple bits in a row, you can represent larger numbers using binary code.<\/p>\n\n\n\n<h3 id=\"Computers, Data, and Abstraction_Binary Code\" class=\"wp-block-heading\">Binary Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Because the transistors in computers can only be in one of two states (<em>on<\/em>&nbsp;or&nbsp;<em>off<\/em>) they need to use a counting system that is&nbsp;<em>base two<\/em>&nbsp;to represent numbers larger than 1. This base-two system is also known as&nbsp;<em>binary code<\/em>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Base-Ten vs. Base-Two (Binary)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The system of counting that we use in our everyday lives is called&nbsp;<em>base ten<\/em>, because it uses 10 possible digits: 0 through 9. It has enough different values to count up to 9 (which is ten total values, because it starts at zero), but if we want to represent anything higher than 9, we add a new column to the left to keep track of how many 10s we have, and start back at 0 in the first column.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As we count up, each time we get to 9 and need to add 1 more, we increase the value in that second column by 1. If we get to 9 in that second column and 9 in the first column and need to add 1 more, we need to add a third column, to show how many hundreds we have, and start the whole process again. Once we get ten 10s in the hundreds column, we add a new column for how many thousands we have and start again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you are familiar with the math concept of exponents and raising numbers to a power, each new column is 10 raised to the next highest power e.g. the tens place is 10<sup>2<\/sup>&nbsp;(10&#215;10), the hundreds place is 10<sup>3<\/sup>&nbsp;(10x10x10), etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When we write a number like&nbsp;<strong>32,706<\/strong>&nbsp;each digit is showing how many we have of each of these multiples of 10:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"905\" height=\"486\" data-id=\"602\" src=\"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/Screenshot-2025-12-22-170912.png\" alt=\"32706 in base 10\" class=\"wp-image-602\" srcset=\"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/Screenshot-2025-12-22-170912.png 905w, https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/Screenshot-2025-12-22-170912-300x161.png 300w, https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/Screenshot-2025-12-22-170912-768x412.png 768w\" sizes=\"auto, (max-width: 905px) 100vw, 905px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When we are using base-two, it&#8217;s the exact same process, but there are only 2 possible values &#8211; 0 and 1 &#8211; so each column represents a multiple of 2 rather than a multiple of 10. Instead of starting over when we get to 9, we start over when we get to 1.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To represent the number 53 in binary code, which is base two, we would write&nbsp;<strong>110101<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"472\" data-id=\"603\" src=\"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/Screenshot-2025-12-22-170921.png\" alt=\"110101 in base 2\" class=\"wp-image-603\" srcset=\"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/Screenshot-2025-12-22-170921.png 814w, https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/Screenshot-2025-12-22-170921-300x174.png 300w, https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/Screenshot-2025-12-22-170921-768x445.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Because you only need 2 values for each digit&#8217;s place, you can use a simple on\/off switch like a transistor to represent each bit and store its place value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As you increase the number of bits, you increase the size of the number that can be represented. The maximum value that can be represented by a binary number is 2 to the power of how many digits long it is. For example, the maximum value of a binary number with 8 bits (aka 8 digits long) is 2<sup>8<\/sup>, or 256. Each additional digit of length doubles the maximum value that can be represented by that number. A 9 digit (or 9-bit) number can represent 512, a 10-bit number can represent 1024, and so on.<\/p>\n\n\n\n<h3 id=\"Computers, Data, and Abstraction_How Binary Code Becomes Data\" class=\"wp-block-heading\">How Binary Code Becomes Data<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If computers only really understand 1s and 0s, how are we able to store and process human-friendly data like text, images, and video?<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Bytes<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">8 bits stacked together are called a&nbsp;<em>byte<\/em>, which is the basic unit of data storage and processing for modern computers.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading\">Byte<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A byte is the fundamental unit of computer storage and information processing. Bytes (usually) consist of 8 bits, and form the smallest unit that can be stored in computer memory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Computer memory and storage space are measured in bytes, usually with a prefix indicating a multiple of ten (kilobyte = approximately one thousand bytes, gigabyte = 1 billion bytes, etc.)<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Bytes are saved in a computer&#8217;s memory by turning individual transistors (in groups of 8) on or off corresponding to the 0 or 1 value of each respective bit. Even the simplest modern computers can contain millions and millions of these transistors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Depending on the context, a given byte can represent different things.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To represent text, there is a system known as ASCII (pronounced&nbsp;<em>ACE-key<\/em>) that standardizes which letters and numbers are represented by which bytes. Each numerical value stored as an 8-bit byte corresponds to a letter of the alphabet, a number, or a symbol. The byte stored by the 8-bit number 01000010 (which is the number&nbsp;<em>66<\/em>&nbsp;in base-ten) is a capital B, while the byte 01001100 (76) stands for capital L, and 01001101 (77) stands for capital M.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The 3-letter phrase&nbsp;<em>BLM<\/em>&nbsp;stored as ASCII text in computer memory would look like the following:<br>01000010 01001100 01001101<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Other kinds of data, for example images or video, use bytes in a different way. Digital images are made up of thousands of individual dots known as&nbsp;<em>picture elements<\/em>&nbsp;or&nbsp;<em>pixels<\/em>. The color of each individual pixel is stored as 3 bytes, representing the red, green, and blue values for that pixel (see sidebar).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In a pixel, that same set of bytes that represented the letters&nbsp;<em>BLM<\/em>:<br>01000010 01001100 01001101<br>would represent a dark grey color:&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By stacking up many, many (many!) bytes of a given type, computers can store and process massive amounts of information, which we call data. We can then program computers to manipulate this data in all sorts of ways.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\"><strong>Digital screens<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A digital screen contains millions of tiny dots known as&nbsp;<em>pixels<\/em>. Each pixel is actually made up of three extremely tiny red, green, and blue light bulbs. The relative brightness of each tiny bulb determines what color the pixel will appear to have. Every color the human eye can perceive can be generated by combining different brightnesses of red, green, and blue light.<\/p>\n<\/div>\n\n\n\n<h3 id=\"Computers, Data, and Abstraction_Abstraction\" class=\"wp-block-heading\">Abstraction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Dealing with individual bits and bytes themselves can be extremely complicated, and doing so successfully requires intimate knowledge of the electrical machines and circuits that computers are built on. Fortunately, most programmers never have to directly touch the bits and bytes that represent the data we work with, thanks to a concept called&nbsp;<strong>abstraction.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading\">Abstraction<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Abstraction&nbsp;is the process of providing a way to accomplish a task, which does not require knowledge of how the task is achieved.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It allows users to employ potentially complicated, multi-step technical processes without having to know the implementation details of how the task is accomplished.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This is where the more complicated parts of a process (which are sometimes called implementation details) are hidden away or&nbsp;<em>abstracted<\/em>&nbsp;behind a more simplified interface, which allows them to be accessed in a more user-friendly way.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A real-world example of abstraction is the steering wheel of a car.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When a driver turns the steering wheel of a car, they are kicking off a complicated series of mechanical processes. The steering wheel is attached to the steering column, which manipulates the car&#8217;s axles, which uses a differential to cause the car&#8217;s tires to be able to rotate at different speeds in a precise relationship, which ultimately results in the car moving in the intended direction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The driver doesn&#8217;t need to know anything about these implementation details to successfully drive the car; they just need to learn the behavior of the steering wheel.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-ef0cee39 wp-block-columns-is-layout-flex\" style=\"margin-top:0;margin-bottom:0;padding-right:0;padding-left:0\">\n<div class=\"wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"has-text-align-center wp-block-paragraph\">Implementation Details:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"404\" height=\"550\" src=\"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/steering-wheel.png\" alt=\"Implementation details of a steering wheel\" class=\"wp-image-476\" srcset=\"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/steering-wheel.png 404w, https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/steering-wheel-220x300.png 220w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-stretch is-layout-flow wp-block-column-is-layout-flow\" style=\"padding-top:0;padding-bottom:0\">\n<p class=\"has-text-align-center wp-block-paragraph\">Abstraction:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\" style=\"margin-top:61px;margin-bottom:61px\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"500\" src=\"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/steering-abstracted.png\" alt=\"Abstraction of a steering wheel\" class=\"wp-image-475\" srcset=\"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/steering-abstracted.png 500w, https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/steering-abstracted-300x300.png 300w, https:\/\/sts.doit.wisc.edu\/training-materials\/wp-content\/uploads\/2025\/12\/steering-abstracted-150x150.png 150w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The engineers who built the car required complex technical knowledge to solve the mechanical challenge of making the car turn. By applying that knowledge, they were able to create a much simpler, abstracted interface that everyday drivers could operate without issue.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This same process also applies when working with the electrical machines we know as computers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Virtually all programming relies on one or more layers of abstraction to control the computer.<\/strong>&nbsp;Unless they are manually changing the transistors and re-routing circuits by hand, programmers are using abstraction to get the computer to compute.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Abstraction and Programming<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s say we have a simple program in Python that prompts the user to enter their name, then outputs how many letters long their name is.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The code itself would look something like this:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-127c69c521444991600ea9c03560fee7\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;print(&#039;What is your name?&#039;)\nname = input()\nnameLength = len(name)\nprint(nameLength)&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This simple-seeming task actually involves many technical processes shown in the following list. The steps that are <strong>bolded<\/strong> are the only ones the programmer needs to write.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-b4b75a54 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<ul id=\"abstraction-list\" class=\"wp-block-list\">\n<li>Parse the program to make sure the code is valid and uses correct syntax<\/li>\n\n\n\n<li>Allocate enough computer memory to keep the code active while the program runs<\/li>\n\n\n\n<li><strong>Display text on screen<\/strong><\/li>\n\n\n\n<li>Illuminate the correct pixels to accurately render the text on screen<\/li>\n\n\n\n<li><strong>Ask for input from the user<\/strong><\/li>\n\n\n\n<li>Listen for the electrical circuit interrupts that indicate keystrokes from the keyboard<\/li>\n\n\n\n<li>Convert characters from keystrokes into their respective ASCII byte codes<\/li>\n\n\n\n<li>Allocate a sufficient number of bytes of computer memory to store the word the user inputs and a count of the letters<\/li>\n\n\n\n<li>Capture the location of the data in the physical memory chips for recall later<\/li>\n\n\n\n<li>Convert bytes into their corresponding bit values<\/li>\n\n\n\n<li>Store the bits from the data in the computer memory<\/li>\n\n\n\n<li>Configure the electrical logic gates into the arrangement of bits for each individual byte<\/li>\n\n\n\n<li>Flip the electromagnetic switches in the computer memory to set each bit value on or off<\/li>\n\n\n\n<li>Use a function to save each individual byte in memory of the word and create a counter that goes up by 1 for each letter<\/li>\n\n\n\n<li>Return the number of letters saved<\/li>\n\n\n\n<li><strong>Store the number of letters in the input<\/strong><\/li>\n\n\n\n<li><strong>Display the number of items to the user<\/strong><\/li>\n\n\n\n<li>Conclude the program and release the stored memory<\/li>\n<\/ul>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The simplicity we enjoy is possible because so much of the complexity has been abstracted away from us as programmers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thousands of person-hours have been spent researching, implementing, and troubleshooting all of the electronic systems and digital components involved in these processes. The people who have performed that labor poured their effort into creating simplified, abstracted interfaces that we as programmers can use to accomplish tasks and efficiently solve problems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One practical example of the abstraction process letting us harness the complexity of computers and use them in accessible, understandable ways can be seen in the form of&nbsp;<strong>programming languages<\/strong>.<\/p>\n<\/section>\n\n\n\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">Programming Languages<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Programs are sets of instructions that a computer can follow to perform a given task. These instructions are provided in one or more&nbsp;<em>programming languages<\/em>.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading\">Programming Languages<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A programming language is a medium that instructions can be written in that a computer can interpret to execute a given task.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Like human languages, most programming languages have certain structures and concepts in common but each has its own syntax and vocabulary.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Different languages are used for different things. Python, Java, and C++ are good general-purpose languages and can be used for a wide range of tasks. JavaScript is mainly used to give interactivity to web pages. Some languages have very specific functions: R is built for statistical analysis, and MATLAB is meant for matrix-based math.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Low-level vs. High-level<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A programming language may be referred to as a&nbsp;<em>low-level<\/em>&nbsp;or&nbsp;<em>high-level<\/em>&nbsp;language. This refers to how much abstraction there is between the code you write and what it&#8217;s telling the computer hardware to do.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>A low-level language like C++ has fewer layers of abstraction between the code and hardware,<\/em><\/strong>&nbsp;which means it can be used for more performance-intensive tasks because less of the computer&#8217;s processing power is needed to interpret and execute the code. This is why high-performance programs like Adobe Photoshop and many video games are written in C++.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>A higher-level language like JavaScript has more layers of abstraction<\/em>.<\/strong>&nbsp;It is not as good at maximizing performance, but in exchange, many technical tasks are handled automatically (like managing program memory, clearing out old variables, etc.) so the programmer doesn&#8217;t need to worry about them.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-important has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\"><strong>Java and JavaScript are different!<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Despite very similar names, Java and JavaScript are two completely different, unrelated languages!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The general-purpose language&nbsp;<em>Java<\/em>&nbsp;was developed in the early 1990s and quickly became extremely popular among programmers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A few years later, as web sites and internet access became more widespread, a new language was developed to provide interactivity for web pages, which had previously been strictly text and images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The developers of this new language named it&nbsp;<em>JavaScript<\/em>, in hopes of cashing in on the growing popularity of Java.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This choice has led to widespread confusion ever since!<\/p>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Popular Languages and Their Uses<\/h3>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-table\"><table class=\"has-base-background-color has-background has-fixed-layout\"><tbody><tr><th class=\"has-text-align-center\" data-align=\"center\"><strong>Name<\/strong><\/th><td class=\"has-text-align-center\" data-align=\"center\"><strong>Used For<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Pros<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Cons<\/strong><\/td><th class=\"has-text-align-center\" data-align=\"center\"><strong>Who should learn<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>How hard to learn<\/strong><\/th><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">C\/C++<\/td><td class=\"has-text-align-center\" data-align=\"center\">General programming, especially good for applications where it&#8217;s important to get the most out of hardware, such as media applications and video games<\/td><td class=\"has-text-align-center\" data-align=\"center\">Very efficient, can be compiled and run on many platforms<\/td><td class=\"has-text-align-center\" data-align=\"center\">Moderately complex, requires programmers to manage many things themselves like memory allocation, interacting with hardware devices, etc.<\/td><td class=\"has-text-align-center\" data-align=\"center\">People doing performance-intensive coding, systems programmers<\/td><td class=\"has-text-align-center\" data-align=\"center\"><br>\u2605\u2605\u2605\u2605\u2606<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Java<\/td><td class=\"has-text-align-center\" data-align=\"center\">One of the most widely used programming languages today. It is used for everything: servers, medical equipment, Android apps, games, Blu-Ray players, smart-home accessories, etc.<\/td><td class=\"has-text-align-center\" data-align=\"center\">All-purpose language, &#8220;write once, run anywhere&#8221; philosophy.<\/td><td class=\"has-text-align-center\" data-align=\"center\">The syntax can be unnecessarily lengthy, and there is a lot of conflicting information about best practices.<\/td><td class=\"has-text-align-center\" data-align=\"center\">CS majors, Android developers, people who want to learn all aspects of programming.<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u2605\u2605\u2605\u2606\u2606<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">JavaScript<\/td><td class=\"has-text-align-center\" data-align=\"center\">Providing interactivity and functionality on the web.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Making web pages interactive, creating many of the elements we associate with the internet today. Reasonably straightforward to learn, and you can see results right away. Good for newer programmers.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Some of the syntax rules can be inconsistent. Not always great for performance. Need to know HTML and CSS to get the most out of it. Requires a web browser (usually).<\/td><td class=\"has-text-align-center\" data-align=\"center\">Anyone interested in learning to code.<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u2605\u2605\u2605\u2606\u2606<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Python<\/td><td class=\"has-text-align-center\" data-align=\"center\">One of the most popular general-purpose programming languages in recent times. Widely used in artificial intelligence, machine learning, data analysis, and many other data-related tasks.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Syntax is easier to read than many other languages. Has a huge number of libraries and code snippets that make life easier. Very approachable for people with no previous coding experience.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Because it&#8217;s so popular, it can be hard to know where to start, or where to find answers to specific questions.<\/td><td class=\"has-text-align-center\" data-align=\"center\">People learning to code, machine learning\/AI coders, data scientists<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u2605\u2605\u2606\u2606\u2606<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">HTML<\/td><td class=\"has-text-align-center\" data-align=\"center\">Creating and structuring content for web pages.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Simple syntax, extremely practical skill to have. Nearly all rich-text editors (e.g. Canvas, WordPress, etc) offer a way to directly edit HTML, which can be helpful when formatting content online<\/td><td class=\"has-text-align-center\" data-align=\"center\">Not a &#8216;traditional&#8217; programming language, so it lacks things like variables, functions, loops, conditionals, etc.<\/td><td class=\"has-text-align-center\" data-align=\"center\">People interested in making websites, or programmers who will be making apps used on the web.<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u2605\u2606\u2606\u2606\u2606<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">CSS<\/td><td class=\"has-text-align-center\" data-align=\"center\">Applying visual style to HTML content.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Flexible, rich set of tools for styling text, images, and providing limited interactivity<\/td><td class=\"has-text-align-center\" data-align=\"center\">Not a &#8216;traditional&#8217; programming language. Can be tricky to understand how style rules get applied.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Designers who want to learn relevant coding skills, people interested in making websites, or programmers who will be making apps used on the web.<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u2605\u2605\u2606\u2606\u2606<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">PHP<\/td><td class=\"has-text-align-center\" data-align=\"center\">Creating web-based apps and dynamic web sites.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Extremely popular choice for building dynamic web sites, pretty straightforward to get started with, can be integrated into existing web pages without much fuss, good for working with MySQL databases<\/td><td class=\"has-text-align-center\" data-align=\"center\">Syntax can be unintuitive, some confusing elements in the built-in functions,<\/td><td class=\"has-text-align-center\" data-align=\"center\">People looking to get immediate results, built dynamic websites, work with databases, or learn to develop tools for platforms like WordPress and Drupal<\/td><td class=\"has-text-align-center\" data-align=\"center\">\u2605\u2605\u2605\u2606\u2606<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n\n<h3 id=\"Programming Languages_Learning a Programming Language\" class=\"wp-block-heading\">Learning a Programming Language<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Becoming proficient in a programming language is similar to learning a spoken language:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Learn the syntax<\/li>\n\n\n\n<li>Build a vocabulary<\/li>\n\n\n\n<li>Become familiar with the patterns, idioms, and style of the language<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">Syntax<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The way the different parts of a programming language go together is called the language&#8217;s&nbsp;<strong>syntax<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Correct syntax is essential with programming. Unlike with spoken languages, where most of the time you can still communicate even if things are phrased incorrectly,&nbsp;<strong>computer programs will not function with incorrect syntax.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most programming languages are made up of the same components: variables, functions, loops, etc. The specific way you assign a variable or declare a function varies from language to language according to its syntax. The first step in learning a programming language is to become familiar with how these fundamentals are written.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Vocabulary<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Once you know how to write statements correctly, the next step is to build a vocabulary. This usually starts with learning the functions and operations most commonly used in that language.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, in JavaScript, programmers frequently need to identify a particular HTML element by its ID attribute and save it to a variable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A very common way this is done is by using the function&nbsp;document.getElementById()&nbsp;like so:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-6066f9c58b96c94e6f30a1faad0f1c9b\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;em&gt;&lt;strong&gt;var myElement = document.getElementById(&quot;article-body&quot;);&lt;\/strong&gt;&lt;\/em&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The first few times you encounter this construction, it will most likely take some effort to step through each piece and figure out what is going on.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As you become more familiar with the language, you&#8217;ll be able to look at this statement and understand at a glance what it&#8217;s doing, rather than having to stop and puzzle through each piece.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As your vocabulary grows and more phrases become second nature, you&#8217;ll require less and less active mental energy to read and write code. You won&#8217;t need to consciously translate your intent (e.g. &#8220;I want to save a variable so I can use it later &#8211; what function do I need to use for that again?&#8221;) and instead you will be able to express your intentions fluidly in code on the fly.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Patterns, Idioms, and Style<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Once you have decent working vocabulary in a language, you may start to notice different constructions and conventions pop up.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, in JavaScript there is a very common design pattern called a&nbsp;<em>callback function<\/em>, where an argument passed to one function is an entire function in itself:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-e38b659e57166520d07917b879468613\" style=\"border-style:none;border-width:0px;background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;document.getElementById(&quot;article-body&quot;).addEventListener(&quot;click&quot;, function() {\n    document.getElementById(&quot;demo&quot;).innerHTML = &quot;Hello World&quot;;\n  });&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">There are other ways to accomplish this same task, but knowing that the preferred way of handling a function-within-a-function is to use one of these callbacks, you can write concise, understandable code structures that are more efficient and easier for other JavaScript programmers to make sense of.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every language has its own distinct patterns and conventions. The more familiar you become with a language, the better you are able to use it in a more native, expressive way.<\/p>\n<\/section>\n\n\n\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">Code Anatomy: Data<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every programming language is different, but there are some concepts and ideas that are common to most languages we encounter. This section will explore some of the most common and relevant elements of programming.<\/p>\n\n\n\n<h3 id=\"Code Anatomy: Data_Variables\" class=\"wp-block-heading\">Variables<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Variables are containers that&nbsp;<strong>store data so that it can be used or processed somewhere else in the program.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A variable has two parts:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A name or&nbsp;<em>identifier<\/em>&nbsp;&#8211; how you refer to it<\/li>\n\n\n\n<li>A&nbsp;<em>value<\/em>&nbsp;&#8211; the data it holds<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-group sts-callout-important has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\">Most languages reserve special keywords that cannot be used as names for variables for functions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, in Python, the keywords&nbsp;<em>and<\/em>,&nbsp;<em>or<\/em>, and&nbsp;<em>not<\/em>&nbsp;are reserved.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Different languages have different reserved keywords<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading has-text-align-center\">Variables<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Variables are virtual containers that are used to hold data so that it can be used elsewhere in a program.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They have a&nbsp;<em>name<\/em>&nbsp;(or&nbsp;<em>identifier<\/em>), and contain a&nbsp;<em>value<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Data is almost always assigned to a variable using the&nbsp;<em>assignment operator<\/em>, which is a single equals sign:&nbsp;=<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Examples:<\/p>\n\n\n\n<div class=\"wp-block-group has-background has-global-padding is-layout-constrained wp-container-core-group-is-layout-4020bc60 wp-block-group-is-layout-constrained\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\">\n<pre class=\"wp-block-code has-base-color has-text-color has-link-color has-small-font-size wp-elements-189542d68608466d50c4c770273174d0\"><code class=\"\" data-line=\"\">&lt;em&gt;&lt;strong&gt;x = 23&lt;\/strong&gt;&lt;\/em&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-group has-background has-global-padding is-layout-constrained wp-container-core-group-is-layout-4020bc60 wp-block-group-is-layout-constrained\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\">\n<pre class=\"wp-block-code has-base-color has-text-color has-link-color has-small-font-size wp-elements-1e7a65a159cdb500435c8ad36f155c40\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;var myName = &quot;Bucky&quot;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Most of the time data is assigned to a variable using the equals sign (=), which is sometimes called the&nbsp;<em>assignment operator<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Different languages have different rules around how variables are named and assigned, but the process usually looks like one of the following:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Python:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-8e561de41906af94ac3ddbe0130b4904\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;em&gt;&lt;strong&gt;x=3&lt;\/strong&gt;&lt;\/em&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">PHP:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-8b54f45bf533db37d76711ed6b2c1642\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;$my_name = &quot;Bucky&quot;;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Java:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-20fa1d05b9712fedf6ffad465c75cbce\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;int myAge = 20;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-c8aaff9d155b35c687a89267bcf1ad5c\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;var yourAge = 21;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Each of these has the identifier on the left and the value on the right. Some languages use a keyword like&nbsp;var&nbsp;or a data type designator (e.g.&nbsp;int,&nbsp;String, etc.) when assigning a variable a value. Some languages require variable names to start with symbol like&nbsp;$.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The specific syntax will change from language to language, but nearly all languages assign variables using&nbsp;=<\/p>\n\n\n\n<h3 id=\"Code Anatomy: Data_Data Types\" class=\"wp-block-heading\">Data Types<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">An important concept to understand in programming is the idea of a&nbsp;<em>data type<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Computers have instructions built into them that tell them how to manipulate data, but they are very particular about the kind of data they operate on. Trying to perform an operation on the wrong kind of data could cause the program to work incorrectly or not at all, or could even cause other parts of the system to malfunction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Just like how you can pour a liquid (e.g. milk), but you can&#8217;t pour a solid (e.g. a piece of pizza), some computing operations can only be performed on certain types.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A computer can multiply two numbers (with data type&nbsp;<em>integer<\/em>) together, but if we asked it to multiply two words (which have the data type of&nbsp;<em>String<\/em>), it would crash because it doesn&#8217;t know how to handle that data type for that operation.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading has-text-align-center\">Data Types<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A data type indicates the kind of information that is being referenced\/stored.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common data types include&nbsp;<strong>integers<\/strong>&nbsp;(numbers with no decimals),&nbsp;<strong>strings<\/strong>&nbsp;(text),&nbsp;<strong>floats<\/strong>&nbsp;(numbers with decimals),&nbsp;<strong>Boolean<\/strong>&nbsp;(true\/false), and&nbsp;<strong>arrays<\/strong>&nbsp;or&nbsp;<strong>lists<\/strong>&nbsp;(containers with multiple items).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some programming languages require the programmer to explicitly indicate the type of any data they are storing or accessing. Other languages will try to infer it based on the data being stored\/accessed.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Some languages like C++ and Java require programmers to specify the data type for every variable they assign, which is called&nbsp;<strong>static typing<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is an example of assigning variables using Java (a static-typed language), where we declare a numeric variable of type&nbsp;<em>integer<\/em>&nbsp;or&nbsp;<em>int<\/em>&nbsp;and a text variable of type&nbsp;<em>String<\/em>:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-f1d9def3c3154d9f8bc84cd6b3912bb3\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;int myAge = 20;\nString myName = &quot;Jamie&quot;;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Other languages like Python and JavaScript try to infer the data type of a variable at the time the program is run, based on the value stored in it. This is called&nbsp;<strong>dynamic typing<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is an example of assigning int and string variables in the dynamic-typed language Python:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-9f2ecec77dbe15b5df5f0cff8a4643fd\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;myAge = 20\nmyName = &quot;Jamie&quot;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Notice how the variables do not need a type designation at the start.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Common Data Types<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The following are some of the most common types of data you are likely to encounter as a programmer:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>Type<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Description<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Examples<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">String<\/td><td class=\"has-text-align-center\" data-align=\"center\">A string of letters, numbers, and\/or symbols. These are usually written in quote marks &#8216;like this&#8217; or &#8220;like this&#8221;<\/td><td class=\"has-text-align-center\" data-align=\"center\">&#8220;Jamie&#8221;<br>&#8220;1234&#8221;<br>&#8216;Wait 3-5 minutes&#8217;<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Integer<\/td><td class=\"has-text-align-center\" data-align=\"center\">Whole numbers without a decimal component, up to approximately 4 billion (2<sup>32<\/sup>) values.<\/td><td class=\"has-text-align-center\" data-align=\"center\">7<br>1024<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Long<\/td><td class=\"has-text-align-center\" data-align=\"center\">An integer that can represent numbers over 4 billion.<\/td><td class=\"has-text-align-center\" data-align=\"center\">7<br>6,4096,1024,2048<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Float (or&nbsp;<em>floating-point<\/em>)<\/td><td class=\"has-text-align-center\" data-align=\"center\">Numbers that have a decimal point component<\/td><td class=\"has-text-align-center\" data-align=\"center\">2.5<br>117.0<br>3.1415<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Double (or&nbsp;<em>double-precision float<\/em>)<\/td><td class=\"has-text-align-center\" data-align=\"center\">A more precise version of a float<\/td><td class=\"has-text-align-center\" data-align=\"center\">2.5<br>117.0<br>3.1415<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Boolean<\/td><td class=\"has-text-align-center\" data-align=\"center\">A special data type that can only store one value:&nbsp;<em>true<\/em>&nbsp;or&nbsp;<em>false<\/em>.<\/td><td class=\"has-text-align-center\" data-align=\"center\">true, false<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Character (or&nbsp;<em>char<\/em>)<\/td><td class=\"has-text-align-center\" data-align=\"center\">A single letter, number, or symbol character.<\/td><td class=\"has-text-align-center\" data-align=\"center\">&#8220;g&#8221;<br>&#8220;Y&#8221;<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Array (also called a&nbsp;<em>List<\/em>)<\/td><td class=\"has-text-align-center\" data-align=\"center\">A special data type that can store multiple values, in a specific order. Often written using square brackets [ ], with the values separated by commas. The individual items are often accessed using the&nbsp;<em>index<\/em>, which is their position in the list, e.g. myData[3]<\/td><td class=\"has-text-align-center\" data-align=\"center\">[&#8220;apple&#8221;,&#8221;banana&#8221;,&#8221;cherry&#8221;]<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Dictionary (also called an&nbsp;<em>Associative Array<\/em>)<\/td><td class=\"has-text-align-center\" data-align=\"center\">Like an array, but each item is stored as a key-value pair. Similar to an array, but order does not matter, and values are accessed using their key instead of their position in the list, e.g. myData[&#8220;name&#8221;]<\/td><td class=\"has-text-align-center\" data-align=\"center\">[&#8220;name&#8221;: &#8220;Bucky&#8221;,<br>&#8220;age&#8221;: 20,<br>&#8220;city&#8221;:&#8221;Madison, WI&#8221;]<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n<\/section>\n\n\n\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">Code Anatomy: Behavior<\/h2>\n\n\n\n<h3 id=\"Code Anatomy: Behavior_Operators\" class=\"wp-block-heading\">Operators<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Most programming languages have a set of built-in functions that can be used to manipulate or evaluate data in basic ways. These include things like performing math operations, making logic comparisons like&nbsp;<em>AND<\/em>&nbsp;and&nbsp;<em>OR<\/em>, or incrementing numbers.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Mathematical Operators<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Most languages use specific characters for performing math operations on data. The following are commonly used math operators across languages<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th class=\"has-text-align-center\" data-align=\"center\">Symbol<\/th><th class=\"has-text-align-center\" data-align=\"center\">Operation<\/th><th class=\"has-text-align-center\" data-align=\"center\">Example<\/th><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">+<\/td><td class=\"has-text-align-center\" data-align=\"center\">Addition<\/td><td class=\"has-text-align-center\" data-align=\"center\">2 + 3<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">&#8211;<\/td><td class=\"has-text-align-center\" data-align=\"center\">Subtraction<\/td><td class=\"has-text-align-center\" data-align=\"center\">3 &#8211; 1<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">*<\/td><td class=\"has-text-align-center\" data-align=\"center\">Multiplication<\/td><td class=\"has-text-align-center\" data-align=\"center\">4 * 8<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">\/<\/td><td class=\"has-text-align-center\" data-align=\"center\">Division<\/td><td class=\"has-text-align-center\" data-align=\"center\">8 \/ 2<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">^<\/td><td class=\"has-text-align-center\" data-align=\"center\">Exponent<\/td><td class=\"has-text-align-center\" data-align=\"center\">2^5<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">**<\/td><td class=\"has-text-align-center\" data-align=\"center\">Exponent (Python only)<\/td><td class=\"has-text-align-center\" data-align=\"center\">2**5<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">These operations can be used on raw numbers:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-740ec0432b67ff0d10597135b2d59e71\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;x = 3 + 2&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">They can also be used on variables:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-1a8b687ddd6a909122045f7ab675420a\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;x = 3\ny = 2\n\nz = x * y &lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Logical and Comparison Operators<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Comparing different statements or expressions is another extremely common operation in programming languages, and most languages have dedicated operators for making these comparisons.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some of them compare quantities (less than\/greater than, equals, etc.), while others do logic comparisons, for things like AND and OR.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following table shows common comparisons and their respective operators in different languages:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th class=\"has-text-align-center\" data-align=\"center\">Operation<\/th><th class=\"has-text-align-center\" data-align=\"center\">Definition<\/th><td class=\"has-text-align-center\" data-align=\"center\"><strong>Operator<\/strong><\/td><th class=\"has-text-align-center\" data-align=\"center\">Example<\/th><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Equals<\/td><td class=\"has-text-align-center\" data-align=\"center\">Evaluates whether two items (numbers, strings, booleans, arrays) are equivalent. Returns the value TRUE if so, or FALSE if not.<br>This is often used for IF statements and other program control flow.<\/td><td class=\"has-text-align-center\" data-align=\"center\">==<br>(Note the TWO equals signs &#8211; not one!)<\/td><td class=\"has-text-align-center\" data-align=\"center\">3 == 2+1<br>(True)<br><br>3 == 7<br>(False)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Is Not Equal To<\/td><td class=\"has-text-align-center\" data-align=\"center\">Evaluates whether two items (numbers, strings, booleans, arrays) are NOT equivalent. Returns the value TRUE if so, or FALSE if not.<br>This is often used for IF statements and other program control flow.<\/td><td class=\"has-text-align-center\" data-align=\"center\">!=<\/td><td class=\"has-text-align-center\" data-align=\"center\">3 != 1<br>(True)<br><br>3 != 2+1<br>(False)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Greater Than<\/td><td class=\"has-text-align-center\" data-align=\"center\">Evaluates whether the item on the left is greater than the item on the right and returns TRUE if so, FALSE if not.<\/td><td class=\"has-text-align-center\" data-align=\"center\">&gt;<\/td><td class=\"has-text-align-center\" data-align=\"center\">7 &gt; 3<br>(true)<br><br>2 &gt; 5<br>(false)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Less Than<\/td><td class=\"has-text-align-center\" data-align=\"center\">Evaluates whether the item on the left is less than the item on the right and returns TRUE if so, FALSE if not.<\/td><td class=\"has-text-align-center\" data-align=\"center\">&lt;<\/td><td class=\"has-text-align-center\" data-align=\"center\">3 &lt; 7<br>(true)<br><br>5 &lt; 2<br>(false)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">AND<\/td><td class=\"has-text-align-center\" data-align=\"center\">Used in logic comparisons to evaluate whether multiple statements are true\/false. Returns TRUE if all statements are true, otherwise returns false.<\/td><td class=\"has-text-align-center\" data-align=\"center\"><em>Java<\/em>: &amp;&amp;<br><em>JavaScript<\/em>: &amp;&amp;<br><em>C\/C++<\/em>: &amp;&amp;<br><em>Python<\/em>:&nbsp;and<\/td><td class=\"has-text-align-center\" data-align=\"center\">13 &lt; 17<br>&amp;&amp;<br>pizza == &#8220;food&#8221;<br>(true)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">OR<\/td><td class=\"has-text-align-center\" data-align=\"center\">Used in logic comparisons to evaluate whether any statement is true, when given multiple statements. Returns TRUE if any statement is true, otherwise returns false if all are false.<\/td><td class=\"has-text-align-center\" data-align=\"center\"><em>Java<\/em>: ||<br><em>JavaScript<\/em>: ||<br><em>C\/C++<\/em>: ||<br><em>Python<\/em>:&nbsp;or<\/td><td class=\"has-text-align-center\" data-align=\"center\">13 &gt; 17<br>||<br>&#8220;pizza&#8221; == &#8220;food&#8221;<br>(true)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">Logical NOT<\/td><td class=\"has-text-align-center\" data-align=\"center\">Inverts the truth of the statement it precedes (e.g.&nbsp;!true&nbsp;is equal to&nbsp;false).<br>This is often used when evaluating the result from a function that returns a true\/false response.<\/td><td class=\"has-text-align-center\" data-align=\"center\">!<\/td><td class=\"has-text-align-center\" data-align=\"center\">!(&#8220;pizza&#8221; == &#8220;food&#8221;)<br>(false)<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-group sts-callout-important has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading has-text-align-center\">= and == are different!<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>=<\/strong>&nbsp;(a single equals sign) is the assignment operator, used to assign values to variables.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>==<\/strong>&nbsp;(two equals signs) is the equality comparison operator, used to see whether two items are equal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They are not the same thing!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is one of most common and easiest mistakes for programmers to make. Even seasoned professionals will accidentally mix these up from time to time.<\/p>\n<\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Specialty Operators<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Some operations are (relatively) common in programming languages but not so much in non-programming contexts. It&#8217;s helpful to know the symbols for these operations as you learn to program, even if you may not need to use them frequently.<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>Symbol<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Operation<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Definition<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Example<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">++<\/td><td class=\"has-text-align-center\" data-align=\"center\">Increment (add 1)<\/td><td class=\"has-text-align-center\" data-align=\"center\">Increases an integer or variable by 1. Frequently used in loops and when counting iterations of a task.<\/td><td class=\"has-text-align-center\" data-align=\"center\">For variable&nbsp;<em>myNumber<\/em>:<br>myNumber++<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">&#8212;<\/td><td class=\"has-text-align-center\" data-align=\"center\">Decrement (subtract 1)<\/td><td class=\"has-text-align-center\" data-align=\"center\">Decreases an integer or variable by 1. Frequently when repeating a task a set number of times.<\/td><td class=\"has-text-align-center\" data-align=\"center\">For variable&nbsp;<em>myNumber<\/em>:<br>myNumber&#8211;<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">%<\/td><td class=\"has-text-align-center\" data-align=\"center\">Modulo (sometimes called&nbsp;<em>modulus<\/em>&nbsp;or&nbsp;<em>remainder<\/em>)<\/td><td class=\"has-text-align-center\" data-align=\"center\">Returns the whole-number remainder of division between two integers<\/td><td class=\"has-text-align-center\" data-align=\"center\">15 % 6<br>returns 3<br>(15 \u00f7 6 = 2, remainder 3)<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Functions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Functions are one of the foundational concepts in programming. Nearly every language has some concept of functions, though the syntax varies from language to language<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading has-text-align-center\">Functions<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A function is a block of instructions that can be reused in a program without needing to be rewritten every time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The programmer first&nbsp;<em>declares<\/em>&nbsp;the function, which means giving the function a name and writing the code that it will execute.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once it has been declared, the programmer can then&nbsp;<em>call<\/em>&nbsp;the function elsewhere in the program.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Functions can take input, called&nbsp;<em>arguments<\/em>&nbsp;or&nbsp;<em>parameters<\/em>, and give output, called&nbsp;<em>return values.<\/em><\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">A function can take one or more&nbsp;<strong>arguments<\/strong>, or input. These are a way to get data from outside the function, into the function so it can be processed. They are also sometimes called&nbsp;<em>parameters<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Functions can also have a&nbsp;<strong>return value<\/strong>, or output. This is data the function spits out when the program calls it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Not every function needs a return value, but it is generally good practice to have a function&nbsp;<em>return<\/em>&nbsp;when it is done running its code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For most programming languages, functions are called by using the function name followed by parentheses, e.g.&nbsp;myFunction()&nbsp;which contain any arguments the function may take, or are blank if no arguments are needed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An example of a function (with no arguments) being declared and called in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-7230c2ab07b070954373f442ee98fe72\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;function myFunction() {\n    console.log(&quot;I am a function!&quot;);\n    return;\n}\n\nmyFunction(); \/\/ Prints out &#039;I am a function!&#039; to the browser console.&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">An example of a function (with an argument and a return value) being declared and called in Python:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-3c0f09da2237955828abf7f6d3676a0f\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;def myFunction(myName):\n    outputText = print(&quot;My name is&quot; + myName)\n    return outputText \n    \nmyText = myFunction(&quot;Bucky&quot;) # Assigns the return value of the function to the variable myText\nprint(myText) # Prints out &quot;My name is Bucky&quot; to the screen&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Examples<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s say we are writing a program and want to take a person&#8217;s name as input and spit out a line of text that says, &#8220;Hello, [person&#8217;s name]!&#8221;. We&#8217;ll be outputting this line many places in our program, so it would be helpful to write a function that we can reuse and save ourselves time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To create the function we need to do the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Give the function a name (or&nbsp;<em>declare<\/em>&nbsp;it) so we can call it later.<\/li>\n\n\n\n<li>Make sure it can accept input data (an&nbsp;<em>argument<\/em>).<\/li>\n\n\n\n<li>Write the&nbsp;<em>behavior<\/em>&nbsp;of the function (aka what it does: assemble the text, formatted the way we want it)<\/li>\n\n\n\n<li>Output (or&nbsp;<em>return<\/em>) our line of text<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This is how you might write that function in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-4e967473e18a06e9b59a70431604abb1\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;var sayHello = function(myName) {\n    var outputName = myName; \/\/ Create a variable and set it to be the value from the argument\n    var outputText = &quot;Hello, &quot; + outputName + &quot;!&quot;; \/\/ Create the string of text to return.\n    return outputText; \/\/ Output the variable as a return value\n}\n    \nvar ourText = sayHello(&quot;Bucky&quot;); \n\/\/ Creates a variable named &#039;ourText&#039;, and assigns it a value\n\/\/ The value being assigned is the output of the function - in this case, &#039;Hello, Bucky!&#039;\n\nconsole.log(ourText); \/\/ Output &#039;Hello, Bucky!&#039; to the browser console.&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">In Python, the code might look like this:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-ced110ce8d95473e98a61f4347d14182\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;def sayHello(myName):\n    outputName = myName # Create a variable and set the function&#039;s argument as its value\n    outputText = &quot;Hello, &quot; + outputName + &quot;!&quot; # Create the string of text to output\n    return outputText # Output the variable as a return value\n\nourText = sayHello(&quot;Bucky&quot;) # Create a variable, &#039;ourText&#039;, and assign the function output to it\n\nprint(ourText) # Output the contents of the &#039;text&#039; variable to the command prompt.&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n<\/section>\n\n\n\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">Code Anatomy: Syntax and Program Structure<\/h2>\n\n\n\n<h3 id=\"Code Anatomy: Syntax and Program Structure_Expressions and Statements\" class=\"wp-block-heading\">Expressions and Statements<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Just as words need to be combined into sentences to fully convey meaning, Variables, Data types, and Operators are not particularly useful until they are combined into&nbsp;<strong>statements<\/strong>&nbsp;or&nbsp;<strong>expressions.<\/strong>&nbsp;These are units of code that convey an instruction to the computer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They are subtly different (specifically, an expression has a value associated with it, while a statement does not), but for the purposes of this manual, they can be used interchangeably.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading has-text-align-center\">Statements and Expressions<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Statements and expressions are short blocks of code that produce some behavior in a program and usually involve variables and\/or operators.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They are slightly different (specifically, a statement is a unit of code that produces behavior, an expression has a value associated with it), but most of the time the terms can be used interchangeably.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Most of the code that programmers write is a series of statements or expressions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ending a Statement<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Different languages end statements in different ways.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Languages like JavaScript and Java whose syntax is based on the language C usually use a semicolon to end their statements. This means a single statement or expression can extend over multiple lines, and only ends when the interpreter encounters the semicolon character.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the example below, the statement (which is assigning 3 variables in a single statement), is split over multiple lines.<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-0ada8bbdd26faafa6f7ed1eaf0c83feb\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;var myName = &#039;Bucky&#039;,\n    myAge = 20,\n    currentCourse = &#039;CS 400&#039;;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Python uses the line-endings to indicate the end of a statement. That means statements can&#8217;t extend onto multiple lines.<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-aa2c113ff889e399a99d03844f1f696a\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;myName = &quot;Bucky&quot;\nmyAge = 20&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Blocks<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Most programming languages have some concept of a&nbsp;<em>block<\/em>, or a section of code that is treated as a unit. Things like functions and IF statements (which we will cover later) use blocks to differentiate their code from the rest of the program.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Languages based on C, like Java and JavaScript, use curly braces&nbsp;{ }&nbsp;to indicate a block.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An example of an IF block in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-c8fd7ffc84c748313a9a9d9c9f589f3c\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;if (x == 3) {\n    x = x + 1; \n    console.log(&quot;X now equals 4!&quot;);\n}&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Python is different, in that it uses indentation to indicate blocks:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The same block as written in Python:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-f06eae6391681aa029f52ff6663639c2\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;if x == 3:\n    x = x + 1\n    print(&quot;X now equals 4&quot;)&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Whitespace<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Spaces and linebreaks in code are referred to as&nbsp;<em>whitespace<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some languages like Python care about how the whitespace in statements is formatted and structured, while others like Java and JavaScript do not.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Consider the following examples that use JavaScript. These three bits of code will produce identical results even though the formatting is dramatically different:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-c8fd7ffc84c748313a9a9d9c9f589f3c\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;if (x == 3) {\n    x = x + 1; \n    console.log(&quot;X now equals 4!&quot;);\n}&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-d2a681499e2e0799f4d6bac76c45fc80\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;if \n(x == 3) \n{\nx = \nx + 1; \nconsole\n.log(&quot;X now equals 4!&quot;);\n}&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-dbb3f4b14a4d9bbe931622229c546830\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;if(x==3){x=x+1;console.log(&quot;X now equals 4!&quot;);}&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The spacing is there to improve readability for the humans working on the code, but as far as the computer is concerned, it does not matter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Python, on the other hand, cares a lot about spacing and indentation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Python sees the end of a line as the end of a statement, and it uses indentation to recognize where a block starts and stops.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following bit of code will produce an error if you try to run it because the IF statement block is formatted incorrectly:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-2e35a72d17515df4ff025ad8834e8f88\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;if x == 3:\nx = x + 1\nprint(&quot;X now equals 4&quot;)&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The correct formatting is as follows (note the indentation):<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-f06eae6391681aa029f52ff6663639c2\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;if x == 3:\n    x = x + 1\n    print(&quot;X now equals 4&quot;)&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Many people consider Python easier to read because it requires programmers to use a certain level of formatting consistency.<\/p>\n\n\n\n<h3 id=\"Code Anatomy: Syntax and Program Structure_Comments\" class=\"wp-block-heading\">Comments<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Nearly all programming languages have a way to add&nbsp;<em>comments<\/em>&nbsp;to a program.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Comments are bits of text that are ignored by the computer but help humans who are reading the code understand what it the program is doing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Different languages have different ways to indicate comments.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Python uses the&nbsp;#&nbsp;character:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-83a0ebe5b115071ae8456222a4115ad4\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;myName = &#039;Bucky&#039; \n# Comments are ignored by the computer.&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">JavaScript, Java, C++, and many others use&nbsp;\/\/&nbsp;to create a comment.<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-3454fc4659dd8b8231f3153752d2edb0\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;var myName = &#039;Bucky&#039;;\n\/\/ Comments are ignored by the computer&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">It is good practice to add comments to code that you are writing, to make it clear why that part of the program is coded the way it is.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Comments are essential if you are working with other people on the same code base, but they are also important when working on projects by yourself. Every programmer has had the experience of writing code, then coming back to it a few weeks later and thinking &#8220;What does this do again? Why did I write it this way?&#8221; and having to re-discover what their own code is doing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Comments save time and help you stay organized, even when it&#8217;s just you working on a project yourself.<\/p>\n\n\n\n<h3 id=\"Code Anatomy: Syntax and Program Structure_Objects\" class=\"wp-block-heading\">Objects<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A concept that is extremely common in modern programming is something called an&nbsp;<strong>object<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An object is a structure in programming that has its own self-contained&nbsp;<em>data<\/em>&nbsp;and&nbsp;<em>behavior<\/em>&nbsp;&#8211; its own variables and functions. Objects are extremely helpful for keeping code organized and limiting the complexity of a program by abstracting away details that the programmer doesn&#8217;t need to know about in order to use the code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Variables and functions have special names when they belong to objects. A variable that belongs to an object is a&nbsp;<em>property<\/em>, and a function that belongs to an object is a&nbsp;<em>method<\/em>.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\">Object names almost always begin with a capital letter. This is not required, but it is a very widely used convention to make it easier for programmers to understand when an object is being used.<\/p>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Dot Syntax<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In JavaScript, Python and many other languages, properties and methods are referenced by using the object&#8217;s name, followed by a dot and then the name of the property or method. This is known as&nbsp;<em>dot syntax<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They can be referenced different ways in different languages, but dot syntax is what you are most likely to encounter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following examples use an imaginary object, Bucky (which is an instance of the class Badger), that has the property&nbsp;name&nbsp;and the method&nbsp;sayHello()<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-ff80f0e51104ee657f17b50d73e6a5c7\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;Bucky = new Badger;\nconsole.log(Bucky.name); \/\/ Outputs the property &#039;name&#039;.\nBucky.sayHello(); \/\/ Calls the method\/function sayHello() and executes its code&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">You will frequently run into Objects when using different&nbsp;<em>libraries<\/em>, or pre-written packages of code that can be incorporated into your own projects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, there is a&nbsp;Math&nbsp;object in JavaScript that allows us to use common math functions like rounding and max\/min and constants like pi without having to write them ourselves.<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-0c611d14add171f7fdd24de130e2a67a\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;var p = Math.PI; \/\/ Assigns the variable p the value of pi\nvar x = Math.round(3.7); \/\/ Assigns 4 to the variable x\nvar y = Math.sqrt(16); \/\/ Assigns the square root of 16 (4) to variable y&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Classes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Every object is an instance of a&nbsp;<em>class<\/em>. A class is basically a blueprint that specifies the properties and methods object built constructed from it will have.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Programmers only need to write the definition for the class once, and then every time they create an object based on that class, the object will automatically inherit all of that code for free.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As you get started learning how to program, you will probably not immediately need to know how to write classes of your own, but it is helpful to have an idea of what they are and to know how an object is made or&nbsp;<em>instantiated<\/em>&nbsp;from one.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Instantiating Objects<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Most of the time an object is brought into the program by assigning it to a variable using the&nbsp;new&nbsp;keyword, and referencing a class name:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-221a32dc9060c9c8a5c28bd20769269a\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;Bucky = new Badger;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This is saying &#8220;create an instance of an object called Bucky, and build it according to the blueprint laid out in the class called Badger.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will see this construction frequently when using libraries written by other programmers.<\/p>\n<\/section>\n\n\n\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">Code Anatomy: Control Flow<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This section will look at different ways to direct the code towards the outcomes we want, using two extremely common programming concepts:&nbsp;<em>conditionals<\/em>&nbsp;and&nbsp;<em>loops<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">One of the most useful things we can do with programming is have different code execute based on different conditions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The most common way to trigger different code paths is using an&nbsp;if&nbsp;statement.<\/p>\n\n\n\n<h3 id=\"Code Anatomy: Control Flow_IF statements\" class=\"wp-block-heading\">IF statements<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Say we are writing a weather app and want to customize the message that the user receives depending on the current temperature.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the current temperature is higher than average, we want it to say one thing, and if it&#8217;s lower than average, we want it to say something else.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To accomplish this, we use something called a&nbsp;<strong>conditional<\/strong>, also known as an&nbsp;<strong>IF statement<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the weather example, the conditionals might look like the following:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">(<em>Note: this example does not use a real programming language. It is written in &#8216;pseudocode&#8217;, which means it is using normal human language, but formatted as it would be in a program)<\/em>.<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-9fe659285ad3b0d301fba764ccc05bba\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;If the temperature is higher than normal:\n    Say, &quot;It sure is warm today!&quot;\n\nOr, if the temperature is lower than normal:\n    Say, &quot;It&#039;s cold out!&quot;\n\nOtherwise, \n    Say &quot;It&#039;s typical weather for today.&quot;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Syntax<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The specific syntax for IF statements varies from language to language, but they all tend to follow a basic convention.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will now step through and explain the following example of a conditional written in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-0d7e2b58e70f516ec0fe13879e9b0984\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;if (todayTemp &gt; averageTemp) {\n    console.log(&quot;It sure is warm today!&quot;);\n}\nelse if (todayTemp &lt; averageTemp) {\n    console.log(&quot;It&#039;s cold out!&quot;);\n}\nelse {\n    console.log(&quot;It&#039;s typical weather for today.&quot;);\n}&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The first line of the code sets up the conditional:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-41a67c001ccb9eddc7536c4a5134a919\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;if (todayTemp &gt; averageTemp) {&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;if&nbsp;keyword tells the computer that the next block should only be run if a certain condition is met.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The condition that determines whether the code will run is laid out in the parentheses immediately after the&nbsp;if&nbsp;keyword. This is basically just a yes-or-no question, written out in code. This expression is an example of a&nbsp;<em>Boolean<\/em>, meaning the computer will look at whatever is in the parentheses and evaluate as being&nbsp;true&nbsp;or&nbsp;false.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the question we are asking is &#8220;Is the number in the variable&nbsp;<em>todayTemp<\/em>&nbsp;larger than the number in the variable&nbsp;<em>averageTemp<\/em>?&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the answer is yes &#8211; meaning the expression in parentheses evaluates to&nbsp;true&nbsp;&#8211; the computer will execute the code block laid out by the curly braces&nbsp;{ }<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the expression in the first set of parentheses is&nbsp;true, the computer executes the code in the first set of braces, ignores the next two blocks, and moves on with its life.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the expression is&nbsp;false, the computer looks to see if any other conditions have been specified and proceeds to check those.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The ways we can set up those additional conditions are using the&nbsp;else if&nbsp;and&nbsp;else&nbsp;keywords.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;else if&nbsp;keyword is setting up another yes-no question that will only be asked if the first conditional in the initial&nbsp;if&nbsp;statement is false.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;else&nbsp;keyword sets up code to execute in the event that none of the conditions laid out in the&nbsp;if&nbsp;or&nbsp;else if&nbsp;statements are true.<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-8a60e33eeba21a5e2b2b21be1d770dc3\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;If (condition A) is true, do this.\n\nOtherwise, check if condition B is true. If so, do this other thing.\n\nIf neither A nor B is true, check if condition C is true. If so, do this third thing.\n\nIf none of those are true do this last thing.&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;else&nbsp;code is only executed if none of the other conditions that have been specified are true.<\/p>\n\n\n\n<h3 id=\"Code Anatomy: Control Flow_Loops\" class=\"wp-block-heading\">Loops<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">One of programming&#8217;s superpowers is the ability to quickly do the same task multiple times with a single block of code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Say you had a list of 100 people. In this list, each entry has three pieces of information: their first name, their last name, and their job title.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You want to output each person&#8217;s name and job title as a single item, formatted a particular way:<br><br>Last, First: Title<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Doing this by hand would require multiple steps for each entry:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Copy their last name<\/li>\n\n\n\n<li>Paste their last name into a new location<\/li>\n\n\n\n<li>Add a space after their name<\/li>\n\n\n\n<li>Copy their first name<\/li>\n\n\n\n<li>Paste it after the space<\/li>\n\n\n\n<li>Add a colon : and a space after their first name<\/li>\n\n\n\n<li>Copy their job title<\/li>\n\n\n\n<li>Paste their job title after the colon and space<\/li>\n\n\n\n<li>Output the new item with their name and job title.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s a 9-step process, for each name in the list &#8211; 900 steps in total!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Even if a human were able to perform each step at a consistent (also unrealistic) rate of half a second each, it would still take them 7 and a half minutes to complete.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With a computer, we could go through and complete that task in a fraction of a second using something called a loop.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading has-text-align-center\">Loop<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A loop is a way to have a computer repeat a block of code multiple times according to a set of conditions provided by the programmer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The types of loops you will most often see are&nbsp;<em>for<\/em>&nbsp;loops (most common) and&nbsp;<em>do<\/em>\/<em>while<\/em>&nbsp;loops.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">With loops, we only need to tell the computer how to do the &#8216;last name-first name-job title&#8217; process once, and then as long as the list of data we give it is formatted in a predictable way, it can repeat it as many times as we need.<\/p>\n\n\n\n<h3 id=\"Code Anatomy: Control Flow_For Loops\" class=\"wp-block-heading\">For&nbsp;Loops<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">One of the most common loops we see in programming is called a&nbsp;for&nbsp;loop.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These specify a set of condition using the&nbsp;for&nbsp;keyword (as in, &#8216;for the following conditions, do X&#8217;), and then have a block of code that will be repeated until the conditions are fulfilled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In pseudocode, a&nbsp;for&nbsp;loop is the following:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-8aa15bc0752c22f2250bb5770884947c\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;for (these conditions), repeat the following:\n    code statement 1\n    code statement 2\n    code statement ...&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">To write a&nbsp;for&nbsp;loop for the above example (e.g. take a list and output each item in the format &#8220;Last name, First name: Job Title&#8221;) in JavaScript, the code would look something like this:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-051d3bd03ff2314fb964a8ce5eefa4a1\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">for(var i = 0; i &lt; 30; i++) {\n    outputText = myList&#091;i].lastName + &quot;, &quot; + myList&#091;i].firstName + &quot;: &quot; + myList&#091;i].jobTitle;\n    console.log(outputText)\n}<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This initial statement sets up the whole&nbsp;for&nbsp;block:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-67eae7ff38462492730d5e5de33ba3ac\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;for(var i = 0; i &lt; 100; i++)&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This construction is common in languages that use syntax based on the language C, like C++, Java, and JavaScript. Python does&nbsp;for&nbsp;loops a little bit differently, and we&#8217;ll go through that in a moment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;for&nbsp;keyword lets the computer know it&#8217;s a loop, and the piece inside the parentheses sets the conditions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But what do those conditions mean? The code in the&nbsp;for( &#8230; )&nbsp;piece is a little unusual at first &#8211; let&#8217;s unpack it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s actually three separate statements:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-bddc06a1e4346498471cc2474a242489\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;var i = 0;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-e4a36fcd5bfc78960f60b96017ce1e53\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;i &lt; 100;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-fa89e760fcacd81e714b249bc01bb60c\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;i++;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The first statement:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-bddc06a1e4346498471cc2474a242489\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;var i = 0;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">initializes a variable,&nbsp;i, and sets it to 0. This is just a regular variable and could be called anything, but the convention with&nbsp;for&nbsp;loops is to name it&nbsp;i&nbsp;(for&nbsp;<em>index<\/em>&nbsp;or&nbsp;<em>iterator<\/em>). If there are loops within loops (which is not uncommon), the subsequent variables are often called&nbsp;j,&nbsp;k, etc. as a cue to people looking at the code that it is a sub-loops within the first&nbsp;i.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The second piece:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-e4a36fcd5bfc78960f60b96017ce1e53\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;i &lt; 100;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">sets up the condition when the loop should end. In this case, as long as&nbsp;i&nbsp;is less than 100, the loop should continue. Once&nbsp;i&nbsp;reaches 100, the loop will stop repeating.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But how does&nbsp;i&nbsp;change?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s what the third piece does:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-fa89e760fcacd81e714b249bc01bb60c\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;i++;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">That statement&nbsp;<em>increments<\/em>&nbsp;i&nbsp;by one &#8211; meaning it adds one to the current value of&nbsp;i. It is functionally the same as&nbsp;i = i + 1, but it is such a frequently done operation that it has its own operator,&nbsp;++.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So summing up the&nbsp;for&nbsp;statement construction:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-4caf2994c4fc4d8829d794afac6fd6c4\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">for(var i = 0; i &lt; 100; i++) { &#091;code statements] }<\/code><\/pre>\n<\/div>\n\n\n\n<ol class=\"wp-block-list\">\n<li>for(&#8230;)&nbsp;tells the computer to initiate the loop<\/li>\n\n\n\n<li>var i = 0;&nbsp;runs before the loop starts and sets up the index\/iteration counter that will be used to see whether to continue running the loop<\/li>\n\n\n\n<li>i &lt; 100;&nbsp;runs before each iteration and checks whether the condition has been met (e.g. if&nbsp;i&nbsp;is still less than 100). If not, it executes the next iteration<\/li>\n\n\n\n<li>i++&nbsp;runs after each iteration and increments the counter.<\/li>\n\n\n\n<li>The&nbsp;{ }&nbsp;block contains the code that will be repeated on each iteration.<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-8fed74525418c984255e5d24a807f83b\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;myList = &#091; {&quot;firstName&quot;: &quot;Bucky&quot;, &quot;lastName&quot; : &quot;Badger&quot;, &quot;jobTitle&quot;: &quot;Mascot&quot;}, {&quot;firstName&quot;: &quot;Terry&quot;, &quot;lastName&quot; : &quot;Tortoise&quot;, &quot;jobTitle&quot;: &quot;Slowpoke&quot;}, {&quot;firstName&quot;: &quot;Spongebob&quot;, &quot;lastName&quot; : &quot;Squarepants&quot;, &quot;jobTitle&quot;: &quot;Fry cook&quot;} ]&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n<\/section>\n\n\n\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">The Coding Process<\/h2>\n\n\n\n<h3 id=\"The Coding Process_Editors and IDEs\" class=\"wp-block-heading\">Editors and IDEs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Most programming languages use standard, plain text files for their code scripts. Because these are just regular text, you can open and view most code files with any text editor &#8211; Notepad, TextEdit, or even Microsoft Word.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Even though it&#8217;s technically possible to write programs using Notepad or TextEdit, the experience of writing code is improved immensely by using an editor that&#8217;s specifcally intended for code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some of the quality-of-life enhancements that code editors provide include:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Syntax highlighting.<\/strong>&nbsp;Different parts of the code using different colors or fonts to let you visually differentiate between things like variable names, functions, IF statements, etc. at a glance.<\/li>\n\n\n\n<li><strong>Code completion.<\/strong>&nbsp;Many code editors will auto-complete things like function names or variables that you have created as you type them. This can saves time and can help prevent bugs that come from mis-typing the name of a variable or function.<\/li>\n\n\n\n<li><strong>Linting\/syntax-checking.<\/strong>&nbsp;Code editors let you use something called&nbsp;<em>linting<\/em>, which is the term for making sure your code follows all correct syntax and style conventions. Linters help you find errors before running the program, so you don&#8217;t need to spend time debugging easy to miss errors like forgetting a semicolon at the end of a statement or not closing an IF block.<\/li>\n\n\n\n<li><strong>Debugging Tools.<\/strong>&nbsp;Many code editors offer tools like debuggers that let you step through code line by line and see what each statement is doing. These can help you figure out why a program isn&#8217;t working as expected.<\/li>\n\n\n\n<li><strong>Project\/file management.<\/strong>&nbsp;Many code editors make it easy to find files and see the folder structure for your project at a glance, as well as things like having multiple files open side-by-side in the editing window.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">Code Editors<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">There are a variety of editors available, and they all have different strengths and uses.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some of the most popular general-purpose code editors as of early 2021 include:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Visual Studio Code<\/li>\n\n\n\n<li>Sublime Text<\/li>\n\n\n\n<li>Atom<\/li>\n\n\n\n<li>Brackets<\/li>\n\n\n\n<li>Nova<\/li>\n\n\n\n<li>Notepad++<\/li>\n\n\n\n<li>BBEdit<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Most of these are free and support many different programming languages, from the big ones (C, Java, JavaScript, Python, etc.) to more esoteric ones (Go, Rust, etc.)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Many code editors support extensions or plugins, which allow you to expand the functionality of the editor to do things like custom code highlighting, pre-written snippets, API documentation, and more.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">IDEs<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Some languages are made easier by using an IDE, or&nbsp;<em>Integrated Development Environment.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An IDE is a code editor with more features. They include things like comprehensive syntax-checking, code-completion, documentation for the current programming langage\/API, as well as tools like compilers and package managers. These are extremely important for compiled languages like Java, C++, and Swift, which require the additional step of compiling the code into an application before it can be run.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Many IDEs will have a tool set that focuses on a primary language like Java or Objective-C, but support the syntax and tooling for many other languages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Examples of IDEs include:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Eclipse (Java)<\/li>\n\n\n\n<li>IntelliJ (Java)<\/li>\n\n\n\n<li>PhpStorm (PHP)<\/li>\n\n\n\n<li>XCode (Swift and Objective-C)<\/li>\n\n\n\n<li>Aptana (general purpose)<\/li>\n<\/ol>\n\n\n\n<h3 id=\"The Coding Process_Libraries and APIs\" class=\"wp-block-heading\">Libraries and APIs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s rare for a programmer to write every single line of code that a program uses, especially when working on a large code base. Most programmers incorporate&nbsp;<em>libraries<\/em>&nbsp;into their programs. Libraries are packages of code written by other people, that solve a particular problem or perform a certain function so the programmer doesn&#8217;t have to write it themselves from scratch.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-goodtoknow has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading\">Libraries<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Libraries are collections of code that are meant to be incorporated into other programs to add functionality or make the programmer&#8217;s job easier.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Libraries can range from simple one-or-two line utilities that add basic features, to comprehensive tool kits that provide extensive new functionality to a language.<\/p>\n<\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Standard Library<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Most languages have something called a&nbsp;<em>standard library<\/em>&nbsp;that is packaged with the interpreter\/compiler. The specific functions in a standard library vary from language to language, but they are all doing the same thing: providing features that are not present natively in the core language syntax.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Features in a standard library can include things like file input\/output, functions to sort the items in an array or list, math functions like min\/max, randomize, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some languages have comprehensive standard libraries. Others include only a few basic functions in the standard library, and programmers will include additional packages and libraries when they need more features.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">APIs<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Another term that is common in programming the&nbsp;<em>Application Programming Interface<\/em>, or API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An API is a set of features that provide access to certain functions without the programmer having to write the code themselves. An API is similar to a library, but often more standardized and more comprehensive. It is an example of abstraction, where it allows the programmer to use functionality without having to know the details of how it is implemented.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, the API for Swift and Objective-C (the programming languages used for MacOS and iOS app development) includes functions (also called&nbsp;<em>methods<\/em>) that let the programmer do things like take a photo with the camera in an iPhone without having to know anything about the technical details of the camera itself.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The process of an iPhone camera producing a digital photograph involves many, many complicated steps and requires a complex interplay between the phone&#8217;s hardware and software. Engineers at Apple did the hard work of finding solutions to these processes, and they provided a straightforward way to use that functionality via a command in the API. An everday programmer coding an iPhone app can use the function in the API without having to know any of the complicated aspects of the mechanisms involved.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In JavaScript, the common function&nbsp;document.GetElementByID()&nbsp;is part of the API for working with documents in a web browser.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Coders don&#8217;t need to know anything about how the browser manages page memory, interacts with the operating system, parses the structure of the HTML, or any of the other countless things involved in displaying and accessing the contents of a website. They can simply use that command and it will return the requested item within the page.<\/p>\n\n\n\n<h3 id=\"The Coding Process_Version Control\" class=\"wp-block-heading\">Version Control<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In situations where the code base grows more complicated than one person can easily keep track of or when multiple people are working on a project, it is essential to incorporate&nbsp;<strong>version control<\/strong>&nbsp;into the development process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Version control means keeping a record of all the changes that have been made over the lifespan of a project. This is helpful if the coder wants to refer to a previous version of the program, or if they make a change that breaks something and want to identify where the bug occured. When new code is added or old features are removed, so the coder can revert to previous<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One of the other main features of version control is the ability to create&nbsp;<em>branches<\/em>&nbsp;of a project. A branch is a parallel version of the code that have different sections included. Branches are helpful for testing out new features without affecting the rest of the code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Version control is essential when multiple people are working on a project, because it allows everyone&#8217;s changes to be consolidated into one central set of code without overwriting the work of the other collaborators.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">git and GitHub<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The most common version control system in use today is called&nbsp;<em>git<\/em>. Git is an open-source tool that can be installed in a project folder and can be used to keep track of all files, chnages, and updates over the lifetime of the project. A git project is known as a&nbsp;<em>file repository<\/em>&nbsp;or&nbsp;<em>repo<\/em>&nbsp;for short.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">GitHub is a popular online platform for hosting and collaborating on shared git projects. It is used extensively for collaboration on open source code projects, but it is also used by individuals as a cloud-based way to manage their code.<\/p>\n\n\n\n<div class=\"wp-block-group sts-callout-important has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<h4 class=\"wp-block-heading has-text-align-center\">Git and GitHub are Different!<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Git<\/em>&nbsp;is an open source tool that anyone can download and use locally on their computer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>GitHub<\/em>&nbsp;is an online service\/platform that is owned by Microsoft that is used to facilitate working together on shared git projects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The terms are often used interchangeably, but&nbsp;<strong>you do not need GitHub to use git on your projects<\/strong>. GitHub is the most popular platform for collaborating on code projects, but there are other services you can use as well, such as BitBucket, SourceForge, and Launchpad.<\/p>\n<\/div>\n<\/section>\n\n\n\n<section class=\"wp-block-sts-block-sts-custom-sections\">\n<h2 class=\"wp-block-heading\">References<\/h2>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#05afef;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Computer Program<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A&nbsp;<em>computer program<\/em>&nbsp;is any collection of code that has been written to instruct a computer how to do something. Computer programs go by many names, including scripts, applications\/apps, algorithms, and more.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Anything from a simple 1-line script to a professional application containing millions of lines of code can be considered a program.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#6e3e94;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Bit<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A bit, which is short for&nbsp;<em>binary digit<\/em>, is a unit of information that can be in one of two states (on\/off, true\/false, 0\/1, etc.).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is the fundamental building block of computing and is the basis of binary code, which is how computers read and interact with information.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#f2623c;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Byte<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A byte is the fundamental unit of computer storage and information processing. Bytes (usually) consist of 8 bits, and form the smallest unit that can be stored in computer memory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Computer memory and storage space are measured in bytes, usually with a prefix indicating a multiple of ten (kilobyte = approximately one thousand bytes, gigabyte = 1 billion bytes, etc.)<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#f12993;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Abstraction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Abstraction<\/strong>&nbsp;is the process of providing a way to accomplish a task, which does not require knowledge of how the task is achieved.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It allows users to employ potentially complicated, multi-step technical processes without having to know the implementation details of how the task is accomplished.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#05afef;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Programming Languages<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A programming language is a medium that instructions can be written in that a computer can interpret to execute a given task.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Like human languages, most programming languages have certain structures and concepts in common but each has its own syntax and vocabulary.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#6e3e94;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Variables<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Variables are virtual containers that are used to hold data so that it can be used elsewhere in a program.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They have a&nbsp;<em>name<\/em>&nbsp;(or&nbsp;<em>identifier<\/em>), and contain a&nbsp;<em>value<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Data is almost always assigned to a variable using the&nbsp;<em>assignment operator<\/em>, which is a single equals sign:&nbsp;=<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Examples:<\/em><\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-5a90370acd6e4de267f6c49e1c8fc5b1\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;x = 23&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-base-color has-text-color has-background has-link-color has-small-font-size wp-elements-87ecc230ef686ffaa95d3680d4cfd7d7\" style=\"background-color:#3c3c3c;padding-right:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--80)\"><code class=\"\" data-line=\"\">&lt;strong&gt;&lt;em&gt;var myName = &quot;Bucky&quot;&lt;\/em&gt;&lt;\/strong&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#f2623c;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Data Types<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A data type indicates the kind of information that is being referenced\/stored.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common data types include&nbsp;<strong>integers<\/strong>&nbsp;(numbers with no decimals),&nbsp;<strong>strings<\/strong>&nbsp;(text),&nbsp;<strong>floats<\/strong>&nbsp;(numbers with decimals),&nbsp;<strong>Boolean<\/strong>&nbsp;(true\/false), and&nbsp;<strong>arrays<\/strong>&nbsp;or&nbsp;<strong>lists<\/strong>&nbsp;(containers with multiple items).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some programming languages require the programmer to explicitly indicate the type of any data they are storing or accessing. Other languages will try to infer it based on the data being stored\/accessed.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#f12993;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Functions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A function is a block of instructions that can be reused in a program without needing to be rewritten every time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The programmer first&nbsp;<em>declares<\/em>&nbsp;the function, which means giving the function a name and writing the code that it will execute.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once it has been declared, the programmer can then&nbsp;<em>call<\/em>&nbsp;the function elsewhere in the program.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Functions can take input, called&nbsp;<em>arguments<\/em>&nbsp;or&nbsp;<em>parameters<\/em>, and give output, called&nbsp;<em>return values.<\/em><\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#05afef;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Statements and Expressions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Statements and expressions are short blocks of code that produce some behavior in a program and usually involve variables and\/or operators.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They are slightly different (specifically, a statement is a unit of code that produces behavior, an expression has a value associated with it), but most of the time the terms can be used interchangeably.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#6e3e94;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Loop<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A loop is a way to have a computer repeat a block of code multiple times according to a set of conditions provided by the programmer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The types of loops you will most often see are&nbsp;<em>for<\/em>&nbsp;loops (most common) and&nbsp;<em>do<\/em>\/<em>while<\/em>&nbsp;loops.<\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<div class=\"wp-block-group has-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-color:#f2623c;border-style:solid;border-width:2px;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:4px;border-bottom-right-radius:4px\">\n<h3 class=\"wp-block-heading has-text-align-center\">Libraries<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Libraries are collections of code that are meant to be incorporated into other programs to add functionality or make the programmer&#8217;s job easier.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Libraries can range from simple one-or-two line utilities that add basic features, to comprehensive tool kits that provide extensive new functionality to a language.<\/p>\n<\/div>\n<\/section>\n","protected":false},"author":19,"featured_media":0,"template":"","meta":{"_acf_changed":false,"_uw_seo_meta_title":"","_uw_seo_meta_description":"","_uw_seo_twitter_card_type":"summary_large_image","_uw_seo_meta_image":"","_uw_seo_meta_image_url":"","_uw_seo_meta_image_sizes":[],"_uw_seo_custom_meta_tags":[],"footnotes":""},"categories":[3],"class_list":["post-418","manual","type-manual","status-publish","hentry","category-coding-and-data"],"acf":[],"_links":{"self":[{"href":"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-json\/wp\/v2\/manual\/418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-json\/wp\/v2\/manual"}],"about":[{"href":"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-json\/wp\/v2\/types\/manual"}],"author":[{"embeddable":true,"href":"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-json\/wp\/v2\/users\/19"}],"version-history":[{"count":2,"href":"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-json\/wp\/v2\/manual\/418\/revisions"}],"predecessor-version":[{"id":942,"href":"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-json\/wp\/v2\/manual\/418\/revisions\/942"}],"wp:attachment":[{"href":"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-json\/wp\/v2\/media?parent=418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sts.doit.wisc.edu\/training-materials\/wp-json\/wp\/v2\/categories?post=418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}