0% found this document useful (0 votes)
7 views

Programming Fundamentals

Programming fundamentals discusses key concepts like programming languages, syntax, variables, data types, conditional statements, and arrays. Programming languages translate instructions into machine code. Syntax rules must be followed or errors occur. Variables can store different data types like integers, floats, strings. Conditional statements like if/else evaluate conditions and execute code accordingly. Arrays allow storing multiple values.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Programming Fundamentals

Programming fundamentals discusses key concepts like programming languages, syntax, variables, data types, conditional statements, and arrays. Programming languages translate instructions into machine code. Syntax rules must be followed or errors occur. Variables can store different data types like integers, floats, strings. Conditional statements like if/else evaluate conditions and execute code accordingly. Arrays allow storing multiple values.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Programming fundamentals

◦ Programming languages serve as a middle-man it translate your


instructions into machine code The series of 0's and 1's that the
computer can understand

Low-level programming
languages
Assembly or C
• High-Level programming
languages
Java or Python
Lower the level ->
More similar
to machine code

Syntax - Rules you must follow if you want your program to run
correctly
◦ How you type out certain functions
◦ What you put at the end of each line of code
◦ How you set up certain functions
◦ Syntax for each programming languages is unique
Breaking programming rules will result in an error

Using concatenation to add string together


Print(“Game over “ + 4 + “ was your final score.”)

Variables
Something that can store information

Variables type
Integers, booleans, floats, doubles, Strings, and Chars
◦ Integer'sA variable that can store andInteger value■
⁃ 2,147,483,648 to 2,147,483, 648
CAN'T and WILL NOT hold any decimal values

◦ Both are types of floating point data typesCan store numbers


with decimal places
◦ Float Variables Can store up to 32 bits of information
Double Variables Can store up to 64 bits of information

◦ Char -> Character


◦ Each hold one character
Useful when a programmer wants to read one button press of one
character in a string without using a String variableExample: Game
controlled by keyboard

◦ There is one big rule when naming variables They MUST be one
continuous String
Most programmers name variables according to camelCase Don't
capitalize the first word, but capitalize the first letter of all words
after it
Ex: anotherCamelCaseVariable

Conditional statement
The most basic conditional statement is the If Statement
If something is True do this, otherwise do something else

if (Thing is True) {
Do What's inside the curly braces
}
Whatever is inside the braces will be evaluated as either true or
false

if (Thing is false) {
Skip what's inside the curly
}

Eg:
if(score > 5) {
print ( "Nice Score!" )
}

The Else-if statement will only be evaluated if the preceding if (or if-
else) statement was bypassed due to it being false.
Check more info and example for switch statement
THATs WHERE ARRAY COMES IN it can store a lot of info
You will have an error
Allows us to repeat parts of code multiple times

You might also like