Coding: True and False

Coding in its simplest form can be broken down into 1’s and 0’s. A 1 means it is TRUE and a 0 means it is FALSE. One thing to always keep in mind is that if something is not true then it is false. This system is called Boolean algebra.

When coding it is important to remember that computers have no intuition, so you must state everything and be very specific.

Below is some statements of true and false. It is similar to basic algebra where is you multiply a negative with a negative you get a positive and if you multiply a negative with a positive you get a negative. We are using “!” as the meaning NOT. So if…

  • (!(True)) = False –> Not true (-) x True (+) = –
  • (!(False)) = True –> Not true (-) x False (-) = +

*When working with loops it must always be true to work.

Truth Tables show the outcomes when you combine 2 different coding expressions using “and”, “or”, and “and or”. For example, if the first statement is true OR the second statement is false than the overall statement is true. If the first statement is true AND the second statement is false than the statement must be false, this is because the statement cannot be true if one is true and the other is false. If the first statement is true AND OR the second statement is false than the statement is true. The “and or” table combines the “or” and the “and” so all possibilities are true and will run with the only exception of if both are false.

“OR” Table

A StatementB StatementTrue
TRUEFALSEYES
TRUETRUENO
FALSETRUEYES
FALSEFALSENO

“And” Table

A StatementB StatementTrue
TRUEFALSEFALSE
TRUETRUETRUE
FALSETRUEFALSE
FALSEFALSE*FALSE

“And” “OR” Table

A StatementB StatementTrue
TRUEFALSETRUE
TRUETRUETRUE
FALSETRUETRUE
FALSEFALSEFALSE

RESOURCES USED

Advertisements

Coding 101

I’ve decided to do Coding as my Tech Inquiry project because I see the increasing value in the role technology has in our society and in our classrooms. It is no longer acceptable to just be tech competent, students must learn to be tech fluent. To help me along in this process I have recruited a friend of mine, a 3rd year engineer student at UVIC who has experience in coding, mainly C++.

In this first week I focused on the basic terminology and concepts. I learned that in a coding sense, algorithms are a series of patterns. My friend used an analogy that helped me better understand this. He said, “when you take a shower, what order do you do things in.” I also learned that there were different types of coding languages that they are used for different things.

PROGRAMMING LANGUAGES

  • Java: used for servers
  • Javascript: used for online
  • C++: used for every interface but more complex. Term that defines this language is “Verbose” which means there is more writing involved to do simple tasks
  • Blocky: used to see basic, visual language. Once mastered the user can move onto harder languages
  • Python: used for game development and newer software

I started my coding experience off by using a very simple interface called “Scratch.” The form of coding on scratch is called blocking. This means that the codes are made into blocks that the user can manipulate into doing what they want the program to do. I found this site easy to use because the shape of the codes matches where they can be inputed and all the blocks are colour coated. Although the user can’t see the actual codes, I found this blocking website was an excellent first step to learning the basic logic behind coding, which is highly transferable to other coding languages and platforms. With scratch.mit.edu I was able to learn and practice first hand producing algorithms. I practiced different types of loops and got to learn the ways in which they are used. This included the if, for, and while loops. I also learned about a “nested loop” which means that it is a loop in another loop.

LOOPS

  • If: “If (blank) happens then (blank)”
  • For: (repeat block)
  • While: (repeat until block)
  • Nested: It is used for multiple responses.

Here are some photos of what the interface looks like. While learning how to program I ran into an error where it copied my polar bear and my first challenge became how to delete them….

RESOURCES USED