Codenplay

Instructions

Summary

Program

A program is a set of actions executed by a computer.

Programs structure

Programs consist of instructions, declarations, and expressions.

Instruction - a request to a computer to perform some action.

Declaration - an explanation of something new to a computer.

Expression - a number or string or some math expression.

Instructions are executed in order, one by one.

It's common practice to write each instruction in a new line. In JavaScript, instructions usually end with parentheses and a semicolon.

What is a program?

A program is a set of actions executed by a computer (sometimes we call it an algorithm).

Who creates programs?

Programmers (software developers, software engineers, coders or hackers) create programs. They are like translators between the human and computer world.

What is programming?

Programming is communication with a computer. Programming is a process of explaining to a computer what we need it to do.

What is the code?

Code is just a text that can be understood by a computer. Each program has its own code. Coding is a process of creating code.

Programming languages

To communicate with people we use a language (for example, English). Unfortunately, computers don't understand our language and we can't tell them directly what to do (this will probably change in the future). Therefore, we use special programming languages.

There is a bunch of them (C, C++, C#, PHP, Javascript, Java, Python, Haskell, Pascal, Rust, Go, Swift, TypeScript, Rust, Basic, Perl, R, Assembler, Bash, Powershell, ...). They differ based on usage, execution speed and popularity. To be able to write programs you should know at least one of them, at least a little. Luckily, when you completely understand one programming language you can learn the others much faster, because the basic concepts are very similar.

Javascript

We will learn programming basics using Javascript. Javascript is the perfect choice for the first programming language, because it's simple, powerful and its syntax is similar to other popular languages like C, C++, Java, and PHP.

Programs structure

Programs consist of instructions, declarations, and expressions.

Instruction - a request to a computer to perform some action.

Declaration - an explanation of something new to a computer (for example we can explain a new instruction)

Expression - a number (like 2 or 123) or string (like 'Home' or 'Hello World!') or some math expression with numbers (like 2 + 3 or 7 - 5 + 2). Please note that when we use string expressions we should place them inside quotation marks.

Program execution process

Instructions are executed in order, one by one. When the last instruction's execution is finished, program execution stops. It's common practice to write each instruction in a new line. In JavaScript, instructions usually end with parentheses and a semicolon.

Arguments

We can pass arguments inside the parentheses. Arguments are always expressions. For example, if we have the command "print", which prints a number to the screen, we should pass this number as an argument (example: print(34)).