diff --git a/2 - Getting Started/1.2 - How To Read This Resource.tex b/2 - Getting Started/1.2 - How To Read This Resource.tex index 7cf0f20..5a7dc22 100644 --- a/2 - Getting Started/1.2 - How To Read This Resource.tex +++ b/2 - Getting Started/1.2 - How To Read This Resource.tex @@ -11,5 +11,23 @@ some data structures or algorithms might interest you more than others. \subsection{Keywords} Throughout this resource some words will be highlighted, colored differently or emphasized in order to stand out. -These words will generally be referring to code examples presented in the chapters, for example: -\pigVar{variables, functions, properties}, \pigVal{values} and \pigOut{output}. +These words will generally be referring to code examples presented in the chapters: +\\ + +\begin{tabular}{|l | c | r|} +\hline +Type & Example \\ \hline +Variable & \pigVar{variableName} \\ +Functions & \pigVar{functionName} \\ +Class Properties & \pigVar{propertyName} \\ +Values & \pigVal{"Sample String Value"} \\ +Program Output & \pigOut{Console String Output} \\ \hline +\end{tabular} +\\ + +\par + +\emph{Example:} +\\ +We assign the value of \pigVal{"Sample String"} to the variable \pigVar{sample} then pass in \pigVar{sample} as a parameter to +the function \pigVar{printValue} which will print: \pigOut{The String Is: Sample String}. diff --git a/3 - Functional Programming/1.1 - Variables.tex b/3 - Functional Programming/1.1 - Variables.tex index c5a24e6..26d9794 100644 --- a/3 - Functional Programming/1.1 - Variables.tex +++ b/3 - Functional Programming/1.1 - Variables.tex @@ -1,22 +1,38 @@ -Variables are used to represent values by name and allow you to access the original value or manipulate the original value. -For example we would store the integer value 10 into a variable named "a" which would then allow us to refer to "10" by -using the name "a". +Variables act as aliases to the values that we want them to represent and they allow us to access and manipulate the +values that we assign to them. +For example we could use the variable \pigVar{name} to represent the value \pigVal{"Brett Langdon"}. +We do this with programming so that we can then access the value \pigVal{"Brett Langdon"} with a shorter representation, \pigVar{name}. -\begin{lstlisting} + +\subsection{Declaration} + +To start with variables we need to declare their existence. +By declaring a variable we are saying to the program, here is our alias and here is the value that we want it to represent. + +\begin{lstlisting}[caption={Variable Declaration}] a = 10 print a \end{lstlisting} -In the above example the output would be "10" because the value 10 is stored in the variable "a" and then we access the original value -10 when we print a. +In the above example we are saying that we want to store the integer value \pigVal{10} into the variable \pigVar{a}. +We can then use the variable \pigVar{a} to access the value \pigVal{10}. +This program will output \pigOut{10} rather than \pigOut{a}. +\par + +When we declare variables we are telling the programming language to allocate some space in your computers memory +in order to store the value that you need it to. +The amount of space needed to store each variable depends based on your specific language being used and which data +type is being used to store the value. + + \subsection{Data Types} Programming languages support different types of data types or different types of values that they can represent in variables. -Some programming languages use multiple different types of values but most of them support the basic types: string, integer +Some programming languages use multiple different types of values but most of them support the basic types: string, integer (multiple kinds) and boolean (true or false). -\begin{lstlisting} +\begin{lstlisting}[caption={Data Types}] string = "Brett" integer = 10 boolean = false @@ -24,7 +40,11 @@ boolean = false Please keep in mind that each programming language supports different data types and you should research those types to better understand variables in that language. +As well some programming languages that are strickly typed which requires us to define the data type of the +variable on declaration (unlike our sudo language). + \subsection{Operations} \subsection{Conclusion} + diff --git a/3 - Functional Programming/1.2 - Control Statements.tex b/3 - Functional Programming/1.2 - Control Statements.tex new file mode 100644 index 0000000..b53929a --- /dev/null +++ b/3 - Functional Programming/1.2 - Control Statements.tex @@ -0,0 +1,19 @@ + + +\subsection{If Statements} + +\subsection{If-Else Statements} + +\subsection{For Loops} + +\subsection{While Loops} + +\subsection{Do-While Loops} + +\subsection{Switch Stataments} + +\subsection{Break Statments} + +\subsection{Continue Stataments} + +\subsection{Conclusion} diff --git a/3 - Functional Programming/1.3 - Functions.tex b/3 - Functional Programming/1.3 - Functions.tex new file mode 100644 index 0000000..54a34c1 --- /dev/null +++ b/3 - Functional Programming/1.3 - Functions.tex @@ -0,0 +1,8 @@ + +\subsection{Declaration} + +\subsection{Returns} + +\subsection{Parameters} + +\subsection{Recursion} diff --git a/3 - Functional Programming/1.3 - Control Statements.tex b/4 - Object Oriented Programming/1.1 - Classes and Objects.tex similarity index 100% rename from 3 - Functional Programming/1.3 - Control Statements.tex rename to 4 - Object Oriented Programming/1.1 - Classes and Objects.tex diff --git a/3 - Functional Programming/1.4 - Loops.tex b/4 - Object Oriented Programming/1.2 - Inheritence.tex similarity index 100% rename from 3 - Functional Programming/1.4 - Loops.tex rename to 4 - Object Oriented Programming/1.2 - Inheritence.tex diff --git a/3 - Functional Programming/1.5 - Functions.tex b/4 - Object Oriented Programming/1.3 - Polymorphism.tex similarity index 100% rename from 3 - Functional Programming/1.5 - Functions.tex rename to 4 - Object Oriented Programming/1.3 - Polymorphism.tex diff --git a/4 - Object Oriented Programming/1.4 - Design Patterns.tex b/4 - Object Oriented Programming/1.4 - Design Patterns.tex new file mode 100644 index 0000000..e69de29 diff --git a/Programming In General.pdf b/Programming In General.pdf index 1ffab26..715fa60 100644 Binary files a/Programming In General.pdf and b/Programming In General.pdf differ diff --git a/Programming In General.tex b/Programming In General.tex index 948c521..f0e53fa 100644 --- a/Programming In General.tex +++ b/Programming In General.tex @@ -9,6 +9,7 @@ \usepackage{layout} \usepackage{fancyhdr} \usepackage{color} +\usepackage{setspace} \author{Brett Langdon} \title{Programming In General} @@ -16,6 +17,8 @@ \pagestyle{fancy} \voffset=0.25in +\parskip 10pt +\parindent 0pt \renewcommand{\theenumii}{\arabic{enumii}} \renewcommand{\labelenumii}{\theenumii.} @@ -114,43 +117,64 @@ Brett \textsc{Langdon} \pagebreak \section{Who Is This Resource For} \input{"./1 - Introduction/1.1 - Who Is This Resource For"} - +\vfill +\pagebreak \section{Code Examples} \input{"./1 - Introduction/1.2 - Code Examples"} - +\vfill +\pagebreak \chapter{Getting Started} \input{"./2 - Getting Started/Getting Started"} \vfill \pagebreak \section{Choosing A Programming Language} \input{"./2 - Getting Started/1.1 - Choosing A Programming Language"} - +\vfill +\pagebreak \section{How To Read This Resource} \input{"./2 - Getting Started/1.2 - How To Read This Resource"} - +\vfill +\pagebreak \section{Sudo Language} \input{"./2 - Getting Started/1.3 - Sudo Language"} - +\vfill +\pagebreak \chapter{Functional Programming} \input{"./3 - Functional Programming/Functional Programming"} \vfill \pagebreak \section{Variables} \input{"./3 - Functional Programming/1.1 - Variables"} - +\vfill +\pagebreak \section{Control Statements} -\input{"./3 - Functional Programming/1.3 - Control Statements"} - -\section{Loops} -\input{"./3 - Functional Programming/1.4 - Loops"} - +\input{"./3 - Functional Programming/1.2 - Control Statements"} +\vfill +\pagebreak \section{Functions} -\input{"./3 - Functional Programming/1.5 - Functions"} - +\input{"./3 - Functional Programming/1.3 - Functions"} +\vfill +\pagebreak \chapter{Object Oriented Programming} \input{"./4 - Object Oriented Programming/Object Oriented Programming"} \vfill \pagebreak +\section{Classes and Objects} +\input{"./4 - Object Oriented Programming/1.1 - Classes and Objects"} +\vfill +\pagebreak +\section{Inheritence} +\input{"./4 - Object Oriented Programming/1.2 - Inheritence"} +\vfill +\pagebreak +\section{Polymorphism} +\input{"./4 - Object Oriented Programming/1.3 - Polymorphism"} +\vfill +\pagebreak +\section{Design Patterns} +\input{"./4 - Object Oriented Programming/1.4 - Design Patterns"} +\vfill +\pagebreak \chapter{Data Structures} \input{"./5 - Data Structures/Data Structures"} \vfill diff --git a/build b/build index b474c12..d149d6d 100755 --- a/build +++ b/build @@ -23,6 +23,7 @@ for d in filter(lambda d: not re.search('.git',d),dirs): section = re.sub('\d+.\d+\s-\s|.tex', '', f) book.write('\r\n\section{' + section + '}\r\n') book.write('\input{"' + d + '/' + f.replace('.tex', '') + '"}\r\n') + book.write('\\vfill\r\n\pagebreak') book.write(footer.read()); diff --git a/header.tex b/header.tex index 6dea4b9..dbbe8af 100644 --- a/header.tex +++ b/header.tex @@ -9,6 +9,7 @@ \usepackage{layout} \usepackage{fancyhdr} \usepackage{color} +\usepackage{setspace} \author{Brett Langdon} \title{Programming In General} @@ -16,6 +17,8 @@ \pagestyle{fancy} \voffset=0.25in +\parskip 10pt +\parindent 0pt \renewcommand{\theenumii}{\arabic{enumii}} \renewcommand{\labelenumii}{\theenumii.}