Programming Basics/Printable version


Programming Basics

The current, editable version of this book is available in Wikibooks, the open-content textbooks collection, at
https://en.wikibooks.org/wiki/Programming_Basics

Permission is granted to copy, distribute, and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike 3.0 License.
Category:Print Versions#Programming%20Basics/Printable%20version

Introduction

Concepts

  1. What is programming?
  2. What is an algorithm?
  3. What is coding?
  4. What is a programming language?
  5. What is a translator? Category:Book:Programming Basics#Printable%20version%20


Variables

Variables are tools which are used to store data.

Programming languages often use types to distinguish different kinds of data stored in variables.

Data Type Description Example 1 Example 2 Example 3
Integer Any whole number. 1 300 48
Character A letter of the alphabet. a z y
String A collection of text Wikibooks Programming Basics Hello world!
Category:Book:Programming Basics#Printable%20version%20


Functions

Functions used to store code that is used multiple times throughout a program, especially bits of code that repeat throughout a program.

Functions often take input to make them more versatile. This input is called an argument.

Category:Book:Programming Basics#Printable%20version%20


Conditions

Conditions are used in programming to only do something in the event of something else. This is incredibly useful in a number of tasks.

For example, one might prevent divide by zero errors by check to make sure the devisor is not zero first, and then only dividing if the devisor is not zero.

Category:Book:Programming Basics#Printable%20version%20


Loops

Loops are used to repeat sections of code, either infinitely, or until a condition is met.

There are two common types of loops, While loops and For loops.

Category:Book:Programming Basics#Printable%20version%20


Arrays

Arrays are used to hold multiple related variables.

Example Array
0 1 2 3 4
A r r a y
Category:Book:Programming Basics#Printable%20version%20


Strings

Diagram showing a string structure.

A string is a data type used to store sequences of characters. Strings are often simply an array of characters.

Category:Book:Programming Basics#Printable%20version%20


Files

Files are used to save data to a storage device, which is useful for a number of purposes.

Category:Stubs#Programming%20Basics/Printable%20version Category:Book:Programming Basics#Printable%20version%20


Objects

Objects are a useful tool to handle flexible situations in code. Object Oriented Programming style uses objects extensively.

Category:Stubs#Programming%20Basics/Printable%20version Category:Book:Programming Basics#Printable%20version%20


Category:Book:Programming Basics Category:Pages using the JsonConfig extension Category:Print Versions Category:Stubs