Fundamentals of Syntax
Lab: Building Blocks of Programming
Video Runtime: 08:57
Let’s talk about the fundamentals of syntax. Language has structure and set of rules. We call this syntax.
Your key takeaways are:
- Our languages are
- comprised of a set of rules
- forgiving because we can reason and infer meaning
- Computers
- are not smart
- cannot reason or infer
- Software languages
- have a stringent set of rules
- rules are unique to that language
- each knows how to convert the code into machine code
Study Notes
Language has structure and a set of rules. We call this syntax.
What is syntax?
Per Merriam Webster: “the way in which words are put together to form phrases, clauses, or sentences”
Imagine a software program that has to interpret many different styles of communication?
- Hello, my name is Tonya.
- Hello, I’m Tonya.
- Heya, Tonya’s my name.
- Yo, T’s in the house.
Diverse Languages, Stringent Rules
While our natural language rules is very forgiving, software languages have rules that are not forgiving.
Remember: Computers only know what you tell them to do (they are not smart!):
- They cannot reason
- They cannot infer that although you said “Yo,” it means the same as “Hello”
- They cannot determine what is the end of a command line unless you declare “hey this is the end of this command”
- They need stringent rules in order to do their work
Each programming language can have its own set of rules, its own syntax. Why? Because that language then knows how to convert code into the 1s and 0s.
Language | Code |
---|---|
Python | print “Hello World” |
Ruby | puts “Hello World” |
C# | System.Console.Write(“Hello World”); |
C | printf(“Hello World”); |
Java | System.out.println(“Hello World”); |
PHP | echo ‘Hello World’; |
JavaScript | document.write(“Hello World”); |
LISP | (PRINT (LIST ‘HELLO ‘WORLD))) |
Pascal | writeIn(‘Hello World’); |
VisualBasic | MessageBox(“Hello World”); |
Your best friend is code, Tonya is making the introductions.
Episodes
Total Lab Runtime: 02:17:55
- 1 Lab Introductionfree 06:21
- 2 User-Friendly Expression of Informationfree 22:42
- 3 Fundamentals of Syntaxfree 08:57
- 4 Decision Branching - if/then/elsefree 10:39
- 5 Decision Branching – switch/casefree 07:47
- 6 Basics of Iterationfree 14:14
- 7 Iteration in Practicefree 12:51
- 8 Order of Executionfree 10:55
- 9 Abstractionfree 11:45
- 10 Scoping – Who Can Communicate With Whomfree 31:44