CodingTips
CodingTips
· We use IDE's ( Integrated Development Enviromnents) to write a code. A place to write, run, and
debug code and also convert it to machine code.
· IDE's are like any other program on your computer except used for facilitation of code. Examples
( NetBeans, IntellJ, VisualStudios).
· In addition to a place code, IDE's also include
1- Buil in Error- checking ( For when code doesn't go right).
2- Auto-fill for frequently used words.
3- Project Hierarchy.
· A big step up from previously used methods of programming.
Syntax.
· Rules you must follow to a tee if you want your program to run correctly.
1- How you type out certain functions.
2- What you put at the end of each line of the code.
3- How you set up certain functions.
· Syntax for each programming languages is unique.
· Breaking programming rules will result in an error.
· As example. Let's initialize a variable in Java, Python, and JavaScript.
1- In Java, we must specify which type of variable we are defining, and also add a semicolon at the end
of the line. int variable = 3;
2- In Python, we just type what we want to creat. x = 3
3- In JavaScript, we specify we are making a variable, but don't define what type of variable. var x = 3
· The goal of the program was the same, but all three languages shown look different approaches.
· If ypu forget one semicolon or misplace a character, the entire program will not run and send
you a syntax error.
The console.
· Programmers keep track of their progress by looking at the console.
- A text interface whithin the computer tha us programmers can use for a variety of
purposes.
· The main use of the console is to output text from the program using code, more specifically a
print statement.
- Prints text to the console for the programmers viewing pleasure.
· To use the print statement, simply instruct the console to print, and then whatever you want to
be printed inside the parenthesis.
- Using Python, we can print to the console like so. print("Hello World")
· Print statement is also used for viewing and interpreting the computer's out put from a program.
- Example: computing 4+3 will print nothing to the console.
Printing 4+3 however, will print 7 to the console.
Modulus.
· Most programming languages has an additional operator known as modulus.
- Represented with %.
· Allows us to get the remainder a divisional operation.
· When we take 10 moduls 3...
- We essentially tell the computer to devide 10 by 3, ignore the answer, and give us the
reminder --> 1. print(10 % 3)
· In the case wher there isnt't a remainder..
- The computer will simply print/return 0. print(50 % 2)