<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: iamdestinos</title>
    <description>The latest articles on DEV Community by iamdestinos (@iamdestinos).</description>
    <link>https://dev.to/iamdestinos</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F875455%2Fead71584-6ae1-4704-8404-9009ceaa9079.jpeg</url>
      <title>DEV Community: iamdestinos</title>
      <link>https://dev.to/iamdestinos</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iamdestinos"/>
    <language>en</language>
    <item>
      <title>Java Basics: Functions, Loops, and Non-Primitive Data Types</title>
      <dc:creator>iamdestinos</dc:creator>
      <pubDate>Mon, 24 Oct 2022 02:06:12 +0000</pubDate>
      <link>https://dev.to/iamdestinos/java-basics-functions-loops-and-non-primitive-data-types-17c</link>
      <guid>https://dev.to/iamdestinos/java-basics-functions-loops-and-non-primitive-data-types-17c</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;In a continuation from the &lt;a href="https://dev.to/iamdestinos/java-basics-getting-started-file-syntax-and-variables-1hn6"&gt;previous&lt;/a&gt; blog this one will be going into functions, loops, and non-primitive data types.&lt;/p&gt;

&lt;h2&gt;
  
  
  Functions - But Not Really
&lt;/h2&gt;

&lt;p&gt;In Java, there are technically no functions as Java is a class/object based programming language, so all functions are actually methods. Now, defining a method is rather simple, as there are four parts that make up the syntax for announcing a definition, as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static int add(int x, int y) {
    return x + y;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example the line declaring the method has four pieces to it, static, return type, identifier, and parameters. Static is an unchanging part to method declarations as it tells Java that this is a method for the class it is inside rather than an object. The int in the example is the return type, which is simply saying what type of variable the method returns. While in this case the method returns an int, a method can return any data type or void, which means nothing is returned from the method. The identifier is the name of the method which will be used to invoke the method. An identifier can be named whatever the user wants and typically starts with a lowercase letter. The last piece of the method declaration is the parameter section, which tells the method what type of variables to take in and how many it can take in.&lt;/p&gt;

&lt;h3&gt;
  
  
  Method Overloading
&lt;/h3&gt;

&lt;p&gt;An interesting feature to Java methods is overloading, which allows a method to have multiple definitions, unlike many other programming languages. This allows for a method to take in different arguments and return different data types.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; static int add(int x, int y) {
    return x + y;
  };
  static double add(double x, double y) {
    return x + y;
  };
  static float add(float x, float y) {
    return x + y;
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Loops
&lt;/h2&gt;

&lt;p&gt;Loops are rather simple, allowing a section of code to be repeated a number of times. There are two kinds of loops, while and for.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//while loop
int x = 0;
while(x != 10) {
  System.out.println(x);
  x++;
}
//for loop
for(int i = 0; i &amp;lt; 10; i++) {
  System.out.println(i);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Non-Primitive Data Types
&lt;/h2&gt;

&lt;p&gt;In Java, data types are split into two categories, primitive and non-primitive data types. Primitive data types are noted for taking up a predetermined amount of storage, lacking methods, and starting with a lowercase letter when typed and a number of other qualities. Non-primitive data types are notable for having variable storage size, having methods, and Starting with an uppercase letter when typed. Three notable kinds of non-primitive data types are Strings, Arrays, and Classes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Strings
&lt;/h3&gt;

&lt;p&gt;Strings are a rather simplistic non-primitive data type, storing  a series of characters of variable length. Strings have a number of different methods but some commonly used ones includes the &lt;code&gt;.length&lt;/code&gt; method and the &lt;code&gt;.toUpperCase&lt;/code&gt; and &lt;code&gt;.toLowerCase&lt;/code&gt; methods which turn a string to all uppercase or lowercase letters respectively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String example = "Hello World"
example.length() //returns 11
example.toUpperCase() //returns "HELLO WORLD"
example.toLowerCase() //returns "hello world"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Arrays
&lt;/h3&gt;

&lt;p&gt;Arrays are an indexed list of variable length that hold one specific data type, as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int[] exampleArr = [1, 2, 3, 4];
System.out.println(exampleArr[0]); //prints 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the previous example, the array holds a number of int values. Arrays can hold any number of values but all values must be of the type in the declaration, so an array only holds one data type.&lt;/p&gt;

&lt;h4&gt;
  
  
  Multidimensional Arrays
&lt;/h4&gt;

&lt;p&gt;It is possible to create an array that holds arrays, otherwise known as a multidimensional array, which is done like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int[][] exampleArr2 = { {1, 2, 3}, {2, 4, 6} };
System.out.println(exampleArr2[0][0]); //prints out 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A notable difference from a normal array is the use of the curled brace ({}) instead of the square bracket ([]). It should also be noted that multidimensional arrays can have however many arrays nested within so long as the type declaration includes the number of layers the multidimensional array will have.&lt;/p&gt;

&lt;h3&gt;
  
  
  Classes
&lt;/h3&gt;

&lt;p&gt;The last non-primitive data type to be covered are classes. Java is considered a class-based or object-based programming language as everything is contained within a class and classes can be considered objects. To declare a class, it can be done like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Example {
    int x = 5;
    int y = 10;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simply noting that a class definition is being declared followed up by the identifier (which must start with a capital letter) will serve as the class declaration. To create an instance of this class as an object is shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Example objExample = new Example();
System.out.println(objExample.x); //prints 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;Overall, Java does not have functions, but rather methods which will perform a series of actions when invoked and possibly return a value of some given data type. Loops will perform the same series of actions a number of times, and non-primitive data types are a variably sized storage of data which can have methods and some of which can be defined by the user using classes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Helpful Sources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/java/"&gt;w3Schools&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/iamdestinos/java-basics-getting-started-file-syntax-and-variables-1hn6"&gt;Previous blog on Java&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
    </item>
    <item>
      <title>Java Basics: Getting Started (File Syntax and Variables)</title>
      <dc:creator>iamdestinos</dc:creator>
      <pubDate>Mon, 10 Oct 2022 02:19:03 +0000</pubDate>
      <link>https://dev.to/iamdestinos/java-basics-getting-started-file-syntax-and-variables-1hn6</link>
      <guid>https://dev.to/iamdestinos/java-basics-getting-started-file-syntax-and-variables-1hn6</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Java is an object oriented language owned by Oracle and operates on the premise of "write once, run anywhere". This is accomplished by the fact Java is comprised not only of a programming language, but also a virtual engine that runs the code. While this makes running Java somewhat easy once a user knows what to do, learning how to use Java from scratch can seem rather daunting. This article is here to help get through the beginning of using Java as a programming language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Java
&lt;/h2&gt;

&lt;p&gt;The first step to using Java is to install it. Java can be installed &lt;a href="https://www.oracle.com/java/technologies/downloads/"&gt;here&lt;/a&gt; and instructions for setting it up for windows can be found on &lt;a href="https://www.w3schools.com/java/java_getstarted.asp"&gt;w3schools&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basics of Using Java
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Syntax
&lt;/h3&gt;

&lt;p&gt;The first thing to know when using Java is syntax, as Java has rather strict requirements for how to set up files.&lt;br&gt;
For Java, the first file in a Java application is the &lt;code&gt;Main.java&lt;/code&gt;, which contains this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Main {
  public static void main(String[] args) {
    // whatever contents the user puts here
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first line in the example is the class, which is required for every java file. Classes have a few requirements, mainly that the name must start with a capital letter and the class must share its name with the file (so Main is the class for Main.java, but if the class was called Example, the file would need to be named Example.java).&lt;/p&gt;

&lt;p&gt;The second line contains the main method, which is distinctly different from the class. Unlike the class name, which can be different depending on the file name, every file must have a method with the name main. The main method's purpose is to contain all code that will be executed in the file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic Variables and Statements
&lt;/h3&gt;

&lt;p&gt;Now that the basics of Java file structure has been discussed it is time to talk about the basic variables Java uses and some helpful statements.&lt;/p&gt;

&lt;h4&gt;
  
  
  Comments and Console Logs
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//This is a single line comment
/* This is
a multiline comment */
System.out.println("Hello World"); //will print content to current line in console and anything printed after starts on a new line
System.out.print("Hello World"); //will print on current line and next print will continue on same line in console
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Variable declaration
&lt;/h4&gt;

&lt;p&gt;To declare a variable in Java, users must first declare the type of the variable followed by the name and assigned value, as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String exampleStr = "Hello there"; //variable declaration of type string
int integerVal = 50; //int variables store non decimal numbers
float floatingPointVal = 50.55; //floating point variables store numbers with a decimal
char character = "D"; //character variables store a single character
boolean bool = true; //boolean variables store boolean values (true/false)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;To code with Java users have to make sure every file contains a class sharing the file name which contains a main method within it. Users must also make sure all variables are declared with their given type as well as a name (also called an identifier). &lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/java/default.asp"&gt;w3schools Java tutorial&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.oracle.com"&gt;Oracle website&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
    </item>
    <item>
      <title>Javascript Vs. Java: What's the Difference?</title>
      <dc:creator>iamdestinos</dc:creator>
      <pubDate>Sat, 24 Sep 2022 20:20:46 +0000</pubDate>
      <link>https://dev.to/iamdestinos/javascript-vs-java-whats-the-difference-4gpm</link>
      <guid>https://dev.to/iamdestinos/javascript-vs-java-whats-the-difference-4gpm</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Many people who begin to code start off with learning javascript and an early lesson consists of one simple statement: 'Javascript is not Java'. For most people learning that's all that will be heard, but what exactly is Java? How does it relate to javascript? How is it different from javascript? Well, here's a quick answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Javascript and Java?
&lt;/h2&gt;

&lt;p&gt;To establish the difference between javascript and Java, it is required to know what they are.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Javascript?
&lt;/h3&gt;

&lt;p&gt;Javascript is simply a programming language that was created and is still used for the production of dynamic webpages, although it is used for more than just websites. It often has to rely on dependencies in order to interact with networks and storage (ie: servers and databases).&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Java?
&lt;/h3&gt;

&lt;p&gt;Java, as stated by their owner Oracle, "is a programming language and computing platform", which, to explain in layman terms, is both the code and the mechanism to run said code. It is an object oriented language capable of compiling its code and running on any platform, the basis of this serves as part of Java's slogan "write once, run anywhere". Java's inbuilt runner is known as the Java Virtual Machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  How are Java and Javascript Related?
&lt;/h2&gt;

&lt;p&gt;In terms of relationship there is actually no link between Java and javascript other than the two having similar names and the fact javascript is a trademark name by Oracle. Java was created by Sun Microsystems before the company was bought out by Oracle, while javascript was created by Netscape through developer Brendan Eich (who later acted as one of Mozilla's founders). However, since javascript is run on different engines ownership tends to depend on who created the engine an individual decides to use.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the Differences?
&lt;/h2&gt;

&lt;p&gt;There are a large number of differences between Java and javascript, but some notable differences include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java apps run on any virtual machine/browser while javascript only runs on browsers or servers with the help of node.js.&lt;/li&gt;
&lt;li&gt;Java objects use classes while javascript objects use prototypes.&lt;/li&gt;
&lt;li&gt;Java files end in &lt;code&gt;.java&lt;/code&gt; while javascript files end in &lt;code&gt;.js&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Java requires the Java Development Kit to run while javascript can run on any text editor or browser.&lt;/li&gt;
&lt;li&gt;Java is a back-end language while javascript is both a front-end and back-end language.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;Java and javascript are very different programming languages despite having very similar names. Java is an independent language and machine while javascript relies on many other systems in order to be utilized. Each have their own advantages and disadvantages that sets them apart.&lt;/p&gt;

&lt;h2&gt;
  
  
  Helpful Links/Information Sources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.geeksforgeeks.org/difference-between-java-and-javascript/"&gt;Differences Between Java and JavaScript - GeeksforGeeks&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.java.com/en/"&gt;Java&lt;/a&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Java_(programming_language)"&gt;Java - Wikipedia&lt;/a&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/JavaScript"&gt;JavaScript - Wikipedia&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.java.com/en/download/help/whatis_java.html"&gt;What is Java and why do I need it? Java website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://iq.opengenus.org/who-owns-javascript/"&gt;Who Owns JavaScript?&lt;/a&gt;&lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Write_once,_run_anywhere"&gt;Write Once, Run Anywhere&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>java</category>
    </item>
    <item>
      <title>Python: Visuals</title>
      <dc:creator>iamdestinos</dc:creator>
      <pubDate>Mon, 22 Aug 2022 01:37:48 +0000</pubDate>
      <link>https://dev.to/iamdestinos/python-visuals-m8k</link>
      <guid>https://dev.to/iamdestinos/python-visuals-m8k</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Python is considered a great programming language due to the ease of access and use for new programmers. As part of this easy use, python has access to a plethora of aids to help programmers visualize their code, particularly regarding data visuals. &lt;/p&gt;

&lt;h2&gt;
  
  
  What's a Data Visual?
&lt;/h2&gt;

&lt;p&gt;Some readers may think that data visuals would be things like a webpage or maybe even the console printouts as a way to see a programmer's code. However, data visuals in this article refer to visuals like graphs (line, bar, etc...) or information charts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Data Visuals?
&lt;/h2&gt;

&lt;p&gt;Now, some beginner programmers may wonder why a little graph would be helpful to visualize data and the answer to that is quite simple. Oftentimes a programmer is going to have variables that do not have hard-coded values or have variables that will change over the code's runtime. With these cases it is difficult to mentally process what these values should be or what these values would be at a specific point, which is where data visualizations come into play. Using a graph can be a great way to track how a value changes over time by providing a nifty image for a programmer or even a non-programmer to get data from. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;counter = 0
output = []
while counter &amp;lt; 10:
  counter += 1
  if counter % 2 == 0:
    output.append(counter * 2)
  else:
    output.append(counter * -2)
#What values will output have?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example could likely be figured out with a little bit of work, but what about if the counter went until 20? Or 50? 100? What if the appended value had more complicated conditions or simply more conditionals to go through different operations? Tracking what each value is would be a nightmare that no console statement would help with simply because there is too much to sort through at that point. However, with a graph the code above can be seen as so:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uUgBcKeL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bb8avsc9njinfr1imo67.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uUgBcKeL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bb8avsc9njinfr1imo67.png" alt="Image description" width="595" height="486"&gt;&lt;/a&gt;&lt;br&gt;
(&lt;em&gt;graph generated using the matplotlib module&lt;/em&gt;)&lt;br&gt;
With this handy line graph it is now much easier to see how the values change with each iteration. This visual is very simplistic compared to most but it still shows information that can be useful to understanding the code values.&lt;/p&gt;

&lt;h2&gt;
  
  
  Visual Modules
&lt;/h2&gt;

&lt;p&gt;Python can provide data visuals through some of its modules. The uses and complexity of these modules differs, VPython simply provides visuals related to 3-dimensional shapes whereas matplotlib is oriented to more 2-dimensional charts and graphs (though it does possess some 3-d graphs) that can be customized greatly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Visual Programs
&lt;/h2&gt;

&lt;p&gt;Another way to get visuals in python is through various coding applications and their add-ons. One example of this is Visual Python, an add-on for Jupyter Notebook (a python coding suite) that allows users to plug in modules and data examples into a file of code and show the results in tables and the like.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;Python has access to many different data visuals that help programmers understand data within pieces of code. Whether it is through a module or an app's program, data visuals are an incredibly useful asset for any programmer.&lt;/p&gt;

&lt;h2&gt;
  
  
  useful Links
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://matplotlib.org/"&gt;Matplotlib website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.geeksforgeeks.org/top-8-python-libraries-for-data-visualization/#:~:text=GGplot,using%20high%2Dlevel%20API."&gt;List of Commonly used visuals&lt;/a&gt;&lt;br&gt;
&lt;a href="https://guigui.developpez.com/cours/python/vpython/en/?page=Introduction"&gt;Vpython documentation&lt;/a&gt;&lt;br&gt;
&lt;a href="https://visualpython.ai/about"&gt;Visual Python&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python: Classes, Inheritance, and Modules</title>
      <dc:creator>iamdestinos</dc:creator>
      <pubDate>Mon, 15 Aug 2022 02:16:00 +0000</pubDate>
      <link>https://dev.to/iamdestinos/python-classes-inheritance-and-modules-240n</link>
      <guid>https://dev.to/iamdestinos/python-classes-inheritance-and-modules-240n</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;In a continuation of the &lt;a href="https://dev.to/iamdestinos/python-basics-variables-and-operators-1oik"&gt;last post&lt;/a&gt; about python, I will be covering some slightly more advanced material. This post is about python classes, class inheritance, and modules.&lt;/p&gt;

&lt;h3&gt;
  
  
  Classes
&lt;/h3&gt;

&lt;h4&gt;
  
  
  What's a Class?
&lt;/h4&gt;

&lt;p&gt;Classes are like a framework for making a personalized object, or as w3school puts it, "like an object constructor, or a 'blueprint' for creating objects". Classes essentially serve as an object containing a series of properties and methods (functions).&lt;/p&gt;

&lt;p&gt;Creating a class is rather simple for python, as a class is declared by the 'class' keyword followed by the name of the class and any properties or methods that are desired or needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Creating a class
class Example:
  x = 1 #any variable declared in the class serves as a property
  y = "example text"
  z = True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Properties
&lt;/h4&gt;

&lt;p&gt;As the example above shows, properties are the variables declared and stored in the object. Properties can be any of the data types used in python and can be accessed like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Accessing properties from outside the class
print(Example.x) #prints 1 to console
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Property Manipulation
&lt;/h5&gt;

&lt;p&gt;While class properties are often declared and manipulated inside the class definition, it is possible to add, delete, or modify class properties outside of the definition. It should be noted however, that these manipulations can end up changing the definition or a particular instance of a class depending on how the manipulation is done.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Manipulating Properties of a Class Definition
class Example:
  x = 1
Example.y = 2 #adds new y property to Example
del Example.y #removes y property from Example
Example.x = 3 #modifies existing x property of Example

#Manipulating Properties of a Class Instance
ex1 = Example() #create an instance of the Example class
ex1.y = 2 #adds new y property to ex1 (this particular instance of Example)
print(Example.y) #will cause an error due to y property not existing for Example)
ex1.x = 1 #will modify value of x property for ex1 (this instance)
print(Example.x) #will print 3
print(ex1.x) #will print 1
del ex1.y #delete y property of ex1
del ex1 #delete entire object
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Methods
&lt;/h4&gt;

&lt;p&gt;Methods are functions contained inside a class, capable of doing anything a normal function would&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Creating and using a method
class Example:
  def func():
    print('Hello')
Example.func() #prints 'Hello'
ex1 = Example()
ex.func() #prints 'Hello'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  The init Method
&lt;/h5&gt;

&lt;p&gt;In some cases, it may be necessary to have a class take in a value or perform an action when a class instance is created. To do that, all python classes possess the init method, which will be run whenever a class instance is made.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Using the __init__ method
class Example:
  def __init__(self, x, y): #The self parameter is used to refer to the properties of class inside the class definition
    self.x = x 
    self.y = y
    print('new instance of Example made')
  def add(self): #whenever a method wants to use properties in the class definition, self must be the first parameter
    print(self.x + self.y)
ex1 = Example(1, 2) #will print 'new instance of Example made' due to init
ex1.add() #will print 3 to console
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Pass
&lt;/h4&gt;

&lt;p&gt;A relatively minor class inclusion is pass. Pass is a statement used if a class definition is empty. Normally a class definition requires at least a single line of code inside to not result in an error but pass effectively allows for an empty definition&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Pass example
class Example:
  pass #this results in a no content class, for whatever reason one would be wanted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Class Inheritance
&lt;/h3&gt;

&lt;p&gt;There are cases where a coder may have a bunch of classes that share a number of similar features but also have a number of features that are not shared. To help out with these kinds of situations it is possible to create a class that would possess all of the similar features that could then be used by all of the other objects. This functionality is called class inheritance. Class inheritance works by creating a 'parent function' that contains all the properties and methods that a series of objects share, and child classes that will inherit from the parent class all of these shared items while having its own properties and methods that only the child has.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Parent Class
class Parent:
  def __init__(pers, x, y):
    pers.x = x
    pers.y = y
  #parent method
  def meth():
    print('parent method')
#parent classes are just like a normal class
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Child Classes
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Inheritance demonstration
class Child(Parent):
  pass
ex1 = Child(1, 2)
ex1.meth() #print 'parent method'
#as Child is now it has only the inherited properties and methods from Parent
class Child2(Parent):
  def __init__(self, x, y):
    #the init of Child2 will overwrite the init for Parent. to include the init of Parent this must be used:
    Parent.__init__(self, x, y)
    #anything added from this point on in the init will only apply to the init of Child2
  def meth():
    #another way to have an overwritten method/property inherited is with the super keyword
    super().meth() #meth method takes in from meth function in Parent
ex2 = Child2(2, 4)
ex2.meth() #prints 'parent method'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Modules
&lt;/h3&gt;

&lt;h4&gt;
  
  
  What's a Module?
&lt;/h4&gt;

&lt;p&gt;Modules are pythons equivalent to a library, containing functions and variables that can be used in a coder's files. Python features its own slew of built-in modules available for anyone to use, however, it is possible for people to create their own modules for personal use.&lt;/p&gt;

&lt;h4&gt;
  
  
  Using a Module (Importing)
&lt;/h4&gt;

&lt;p&gt;To use a module is quite simple. Say a coder would want access to python's math module to make use of one of its additional methods, say the square root method. How to do that someone would do as so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#importing a module
import math
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ta-da, quite simple indeed. Just use import and the module name and the file can now use any function from the math module. Now, to use the square root method in math, one would do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a = math.sqrt(4) #use the module name followed by the function name to access the function
print(a) #prints 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Using Modules: Additional Information
&lt;/h5&gt;

&lt;p&gt;Some minor but helpful bits for module usage are aliases, function lists, and importing parts of a module.&lt;/p&gt;

&lt;h6&gt;
  
  
  Aliases
&lt;/h6&gt;

&lt;p&gt;Aliases are a way to refer to a module by a different name. Say a module name is rather difficult to spell correctly or a coder just wants an easy shorthand to use for a module. To use an alias is rather simple, using the as keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Using aliases
import modulename as mn #a module alias can be anything
mn.func() #using an alias to call a function from the module
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  Function list
&lt;/h6&gt;

&lt;p&gt;Sometimes a coder may import a module with a large number of functions or variables without knowing the names of them all. To help know everything a module contains python thankfully has the dir function to help. Dir provides a list of all variable and function names in a given module.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Using dir
import math
funcList = dir(math)
print(funcList) #prints a list of all function/variable names in the math module
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  Importing Parts of a Module
&lt;/h6&gt;

&lt;p&gt;Sometimes a coder may want to access a specific function or variable from a module and so does not want or need the whole module for a file. Python provides a simple way to import part of a module rather than the entire thing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#importing part of a module
from math import sqrt
print(sqrt(4)) #prints 2
#when using a function or variable imported this way, the module name is not used to invoke the imported value
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Making a Module
&lt;/h4&gt;

&lt;p&gt;Making a module is rather easy. To do so a coder would create a python file with variables or functions created as normal followed by naming the file whatever is desired before ending the name in &lt;code&gt;.py&lt;/code&gt;. From there all the coder would need to do is in another file use &lt;code&gt;import modulename&lt;/code&gt; without the &lt;code&gt;.py&lt;/code&gt; and presto! A module has been made and imported.&lt;/p&gt;

&lt;h4&gt;
  
  
  Built-in Modules
&lt;/h4&gt;

&lt;p&gt;Python has a whole slew of modules but some that may be helpful for general purposes are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;math : a series of helpful math functions &lt;/li&gt;
&lt;li&gt;datetime : adds a date object to use and manage dates&lt;/li&gt;
&lt;li&gt;json : use json formatting in python&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Helpful Sources:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/python/python_classes.asp"&gt;w3schools&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.python.org/3/py-modindex.html"&gt;python modules&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
    </item>
    <item>
      <title>Python Basics: Variables and Operators</title>
      <dc:creator>iamdestinos</dc:creator>
      <pubDate>Sun, 07 Aug 2022 23:31:34 +0000</pubDate>
      <link>https://dev.to/iamdestinos/python-basics-variables-and-operators-1oik</link>
      <guid>https://dev.to/iamdestinos/python-basics-variables-and-operators-1oik</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Python is one of the most commonly used programming languages. This post will cover information regarding the basics of Python, specifically variable types and operators.&lt;/p&gt;

&lt;h3&gt;
  
  
  Variables
&lt;/h3&gt;

&lt;p&gt;In order to store values, Python has a series of variable types that store values differently. These variables can be split into two kinds, simple and complex data types. Simple data types hold a single value of a given type while complex data types hold multiple values of various types.&lt;/p&gt;

&lt;h4&gt;
  
  
  Basic Variables (Simple Data Type)
&lt;/h4&gt;

&lt;p&gt;Numbers store numerical values and can be an integer or a float value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a = 1 #integer
b = 3.14 #float
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Strings are capable of storing words, phrases, and symbols as a series of characters&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = "John" #strings are stored between two quotation marks
surname = 'Doe' #they can be marked by double or single quotes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Booleans are a binary value, either being true or false.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bool1 = True #booleans are noted by capitalizing the first character
bool2 = False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Complex Variables (Complex Data Types)
&lt;/h4&gt;

&lt;p&gt;Python has four types of complex variables; lists, tuples, sets, and dictionaries. Each of these variable types store values in a collection but how they store values differ.&lt;/p&gt;

&lt;p&gt;Lists are a collection of values which store values in a 0-indexed order. Lists are also changeable, which allow values to be added, removed, or changed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Lists are similar to javascript arrays as ordered storage of variables
list_example = ["val1", "val2", "val3"] #lists are noted by square brackets
# Lists can be accessed by index values
print(list_example[0])
# print will print "val1" 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tuples are similar to lists in that they are an ordered collection of values but have one key difference: once created they cannot be changed in any way.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tup = ("val1", "val2", "val3") #similar to lists, tuples are noted with parentheses
print(tup[1]) #will print out "val2"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sets are different from lists and tuples, unlike them sets store values in an unordered collection, meaning that whenever a set is accessed the order of values is different. Sets also differ from lists in tuples in that they do not allow duplicate values inside them. Similarly to tuples the values in a set cannot be changed but do allow values to be added and removed&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setex = {"val1", "val2", "val3"} #sets are noted by curled braces
print(setex) #will print out "val1", "val2", and "val3" in a random order
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dictionaries, unlike all other variables store values as key value pairs in an ordered list. In a similar vein to sets, dictionaries cannot have duplicates, but duplicates only apply to the key names. Like lists, dictionaries can be changed by adding, removing, or changing values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dictex = {
  "key": "val",
  "key2": 2
}
# Dictionary values are accessed through its keys
print(dixtex["key"]) #prints "val" to console
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Operators
&lt;/h3&gt;

&lt;p&gt;Operators are symbols that indicate operations to be performed on a value/variable. Python has several different types of operators, including: mathematical, assignment, comparison, logical, identity, and membership.&lt;/p&gt;

&lt;h4&gt;
  
  
  Mathematical Operators
&lt;/h4&gt;

&lt;p&gt;Arithmetic operators are operators that carry out mathematical operations on values. Python has the basic addition and subtraction as shown below as well as some more complex ones.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Addition and Subtraction
a = 10 + 2 #a will equal 12
b = 10 - 2 #b will equal 8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While multiplication and division aren't really complicated, Python has a notable interaction with division. When the division operator is used, Python will have the result be a float no matter what. If an integer is desired, a different operator must be used.&lt;br&gt;
Additionally, Python includes the modulo operator and the power operator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Multiplication and Division
c = 2 * 3 #c will equal 6
#The normal division operator will result in a float value
d = 1 / 2 #d will equal 0.5
#To get an integer or rounded value, use two division operators
e = 1 // 2 #e will equal 0
#Modulo will return the remainder of a division operation
f = 10 % 3 #f will equal 1
#The power operator multiples a number to the given power
g = 2 ** 3 #g will equal 8 or 2 to the third power 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Assignment Operators
&lt;/h4&gt;

&lt;p&gt;Assignment operators allow variables to know to take in a value and in some cases add cases regarding how to take in the value. The basic assignment operator is the = sign, which all other assignment operators will include.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a = 1 #the = sign assigns the value to the variable
a += 2 #equivalent of a = a + 2, which results in 3
b = 3
b -= 2 #equivalent of b = b - 2, which results in 1
c = 2
c *= 3 #equivalent of c = c * 2, which results in 6
d = 3
d /= 4 #equivalent of d = d / 4, which results in 0.75
e = 3
e //= 4 #equivalent of e = e // 4, which results in 0
f = 2
f **= 3 #equivalent of f = f ** 3, which results in 8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Comparison Operators (Boolean checks)
&lt;/h4&gt;

&lt;p&gt;Comparison Operators, as the name implies, carry out a comparison between two values or variables and return a boolean.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a= 2
b = 4
#equals operator checks if two values are equal
comp1 = a == b #results in false
#not equal operator checks if two values are not equal
comp2 = a != b #results in true
#greater than operator checks if first value is greater than the second
c = 3
d = 3
comp3 = c &amp;gt; d #results in false
comp4 = c &amp;gt;= d #results in true, checks if greater or equal to value
#less than operator checks if first value is less than the second
comp5 = a &amp;lt; b #results in true
comp6 = c &amp;lt;= a #results in false, checks if less or equal to value
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Logical Operators
&lt;/h4&gt;

&lt;p&gt;Logical Operators also return a boolean but they take in booleans or operations that result in booleans, allowing a check on multiple comparisons.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#The and operator checks if both conditions are true
cond1 = 1 &amp;lt; 2 and 1 &amp;lt; 5 #results in true
cond2 = 2 &amp;lt; 2 and 2 &amp;lt; 5 #results in false as one condition is false
#The or operator checks if at least one condition is true
cond3 = 1 &amp;lt; 2 or 1 &amp;lt; 5 #results in true since both conditions are true
cond4 = 2 &amp;lt; 2 or 2 &amp;lt; 5 #results in true since one condition is true
cond 5 = 5 &amp;lt; 2 or 5 &amp;lt; 5 #results in false as both conditions are false
#The not operator inverts the result, making true false and vice versa
cond6 = not(1 &amp;lt; 2) #results in false, as 1 &amp;lt; 2 is true and not inverts it
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Identity Operators
&lt;/h4&gt;

&lt;p&gt;Identity Operators are used in the comparison of complex variables, specifically if two variables share the same reference.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var1 = [1, 2, 3]
var2 = [1, 2, 3]
var3 = var1
#The is operator checks if two variables possess the same reference
comp1 = var1 is var2 #results in false, as both refer to different lists even though they have the same values
comp2 = var1 is var3 #results in true, as both refer to the same list reference
#The is not operator  checks if two variables do not possess the same list reference
comp3 = var1 is not var3 #results in false, as both refer to the same list reference
comp4 = var1 is not var2 #results in true, as both refer to different list references
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Membership Operators
&lt;/h4&gt;

&lt;p&gt;Membership Operators are used to check if a value is contained in a collection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setex = {1, 2, 3}
#The in operator checks if a value is contained inside a collection
comp1 = 2 in setex #results in true as 2 is contained in setex
#The not in operator checks if a value is not contained inside a collection
comp 2 = 3 not in setex #results in false as 3 is contained in setex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;In conclusion Python contains many different ways to store values and several operators that can assign and compare them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Helpful Sources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/python/default.asp"&gt;W3schools&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>JavaScript Variable Datatypes</title>
      <dc:creator>iamdestinos</dc:creator>
      <pubDate>Fri, 17 Jun 2022 17:29:25 +0000</pubDate>
      <link>https://dev.to/iamdestinos/javascript-variable-datatypes-3ofh</link>
      <guid>https://dev.to/iamdestinos/javascript-variable-datatypes-3ofh</guid>
      <description>&lt;h2&gt;
  
  
  Variables
&lt;/h2&gt;

&lt;p&gt;Variables, in a simple sense, serve as storage for a value the developer wants to be kept in order to be used later. In JavaScript, a variable has a datatype that is essentially &lt;em&gt;how&lt;/em&gt; a value is kept by the variable. Datatypes are important to be kept in mind by developers as the datatype affects how variable values interact with each other. As W3 Schools rhetorically asks, "Does it make sense to add 'Volvo' to sixteen? Will it produce an error or will it produce a result?"&lt;/p&gt;

&lt;h3&gt;
  
  
  Variable Types
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Numbers
&lt;/h4&gt;

&lt;p&gt;Numbers store a numerical value.&lt;br&gt;
    &lt;code&gt;var num = 0;&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;var num2 = 10 - 1; //num2 is equal to 9&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;var num3 = 2.14;&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;var num4 = 4 + true; //num4 will be equal to NaN, or not a number&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Strings
&lt;/h4&gt;

&lt;p&gt;Strings store characters between either single quotes or double quotes.&lt;br&gt;
    &lt;code&gt;var string = 'This is a string.';&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;var string2 = "2"; //Though 2 is a numerical value it can be stored as a string&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;var string3 = 'Example2';&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;var string4 = 'text' + 4; //string4 is valued as 'text4'&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;var string5 = "You'd expect not to have quotes but you'd be wrong"; //quotes can be used within the string either by using different quotes from outer ones&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Booleans
&lt;/h4&gt;

&lt;p&gt;Booleans have two possible values, true or false.&lt;br&gt;
    &lt;code&gt;var boolean = true;&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;var boolean2 = false;&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Arrays
&lt;/h4&gt;

&lt;p&gt;Arrays are able to store multiple values, which is done in an ordered list that starts at 0.&lt;br&gt;
    &lt;code&gt;var arr = [1, 'two', [], false, {}];&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;console.log(arr[0]); //prints out first value in arr, 1&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;arr[1] = 'test'; //the value of arr at index one, 'two' is now 'test'&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Objects
&lt;/h4&gt;

&lt;p&gt;Objects are similar to arrays in that they store multiple values. Unlike arrays, objects store values in unordered lists known as key-value pairs.&lt;br&gt;
    &lt;code&gt;var obj = {prop1: 1, prop2: 'two', prop3: [], prop4: false, prop5: {}};&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;console.log(obj.prop1); //will print the value of key prop1, or 1&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;console.log(obj['prop3']); //will print the value of key prop3, or []&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Undefined
&lt;/h4&gt;

&lt;p&gt;When a variable is declared without a value, the variable will be undefined in both type and value.&lt;br&gt;
    &lt;code&gt;var example; //if accessed, example is undefined&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;var example2 = true;&lt;br&gt;
    var example2 = undefined; //a variable can also be reassigned as undefined&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple and Complex Datatypes
&lt;/h3&gt;

&lt;p&gt;The six main datatypes (excluding undefined) are split into two different categories, simple and complex. The datatypes in each category share a couple qualities a developer should make note of.&lt;/p&gt;

&lt;h4&gt;
  
  
  Simple Datatypes
&lt;/h4&gt;

&lt;p&gt;Simple datatypes, which are number, string, and boolean variables, possess these qualities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They can only store a single value&lt;/li&gt;
&lt;li&gt;They are copy by value
Copy by value means that whenever a variable of a simple datatype is copied, the value of the variable is literally copied. For example:
&lt;code&gt;var val = 10;&lt;/code&gt;
&lt;code&gt;var newVal = val; //newVal is equal to 10&lt;/code&gt;
&lt;code&gt;val = val - 1; //val is now equal to 9&lt;/code&gt;
&lt;code&gt;console.log(newVal); //prints 10 to console&lt;/code&gt;
In the example, the variable val value is copied by another variable newVal before the value of val is changed. However, the value in newVal remains unchanged as the value was merely copied.
#### Complex Datatypes
Complex datatypes, which are arrays and objects, possess these qualities:&lt;/li&gt;
&lt;li&gt;They can store multiple values
*They are copy by reference
Copy by Reference means that whenever a variable of a complex datatype is copied, the reference of the variable is copied. For example:
&lt;code&gt;var arrVal = [1, 2, 3, 4];&lt;/code&gt;
&lt;code&gt;var newArr = arrVal; //currently the value of newArr is [1, 2, 3, 4]&lt;/code&gt;
&lt;code&gt;newArr[0] = 33; //the array is now [33, 2, 3, 4]&lt;/code&gt;
&lt;code&gt;console.log(arrVal); //prints[33, 2, 3, 4]&lt;/code&gt;
In the example, the variable arrVal is can array that is copied variable newArr. However, when a value in newArr is changed and arrVal is called on, arrVal has the change made to newArr. What happened is that since arrVal is an array newArr, when taking the value of arrVal, took the reference to the array so that both arrVal and newArr are both linked to the same array. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In conclusion javascript variables will store values that a developer wants to be held for later and these values are held in a variety of different datatypes which each have a series of behaviors and interactions for eachother.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/js/js_datatypes.asp"&gt;w3schools - JavaScript Datatypes&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
