INTRODUCTION TO PROGRAMMING
I am collating my study notes as part of my education into Computer Programming. In an attempt to increase and improve my own learning, and to help others also (to learn by teaching) I will be sharing my notes, as neatly presented as possible, for others to follow along with if they so wish. This is Lesson 2's notes. See here for Lesson 1 notes.
INTRODUCTION TO COMPUTER PROGRAMMING – STUDY NOTES
LESSON 2
VARIABLES
LINK: Variables
- Variables are a reference to some information. It can have a changeable value.
- Has an identifier (the name of the variable).
- Examples = Password, Username, etc
In Strongly Typed languages, variables must be declared (see lesson 1).
Example:
[int x = 4] int being the declaration that the variable is of type int, and x is the variable.
C++ is one of the languages that uses this method.
Weakly Typed languages do not need variable declarations (see lesson 1).
Example:
[var length = 10] works as well as [var username = Pete], despite the first being an integer and the second being a string. var indicates the variables, but not the type.
JavaScript is a language that uses this method.
CONSTANTS
LINK: Constants
- Constants are a reference to some information.
- This value cannot be changed.
- Has an identifier (the name of the constant).
Example (C++):
[const int x = 4] the word const indicates that the int that follows is a constant, and it cannot be changed after that declaration. So in this example x will always = 4.
RECAP OF LESSON 1 AND 2
In Lesson 1 we briefly looked at:
- What is a programming language?
- Language Types – especially HIGH Level and LOW Level.
- Compiled vs Interpreted Languages
- Data Types: Strongly Typed vs Weakly Typed Languages.
- Data Types: The most common data types (characters, integers, floating-point, fixed-point, boolean, reference).
In Lesson 2 we looked briefly looked at:
- Variables
- Constants
These both flow on from Data Types and work with these.
FURTHER DATA
cpp.sh - C++ shell website
Scratchpad - Shift + F4 on Firefox - Javascript shell
Dev C++ - A free, portable, fast and simple C/C++ IDE
Code::Blocks - A free C, C++ and Fortran IDE
Ideone - an online compiler and debugging tool which allows youto compile source code and execute it online in more than 60 programming languages.
My Posts
Introduction From a Newbie Programmer.
Introduction to Computer Programming - part 1 (Lesson 1)
Images from unsplash.com.
I welcome new followers, and thank you for your upvotes and comments.
Congratulations! This post has been upvoted from the communal account, @minnowsupport, by humate from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.
If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP. Be sure to leave at least 50SP undelegated on your account.