Welcome to doggo.jl, your home for wholesome Julia tutorials. [swoosh] This episode is the first chapter in a collection of short how-to videos to help you get started on your journey to learning how to write code using the Julia programming language. No programming knowledge is required, so I'm assuming that Julia is your first programming language. To get the most out of these videos, you will need access to a computer with an internet connection. And by computer, I mean either a desktop or a laptop computer running Windows, macOS or Linux. Everything else in the course will be free. As a human, you cannot communicate directly with your computer by using your spoken language. In order for you to "talk" to your computer, you will need to use a programming language. You may think that a programming language is only used by software developers, but there are many different reasons why you may want to use a programming language. Here's a diagram of some humans that may benefit from the use of a computer programming language. At the top of the diagram is the human brain. And at the bottom of the diagram is the computer brain. There is no single programming language that can meet the needs of all of these diverse users. As a result, there are many different programming languages that are currently being used, each with their own unique capabilities. Where you choose to spend your time will determine which programming language is best for you, in order for you to accomplish your goals. The Julia programming language is a good choice for users in the higher tiers. And by "higher", I don't mean "better". By "higher", I mean that users in those tiers need a programming language that works in a way that is closer to the way that a human brain works, as opposed to a programming language in the lower tiers that works in a way that is closer to the way that a computer brain works. The Julia programming language is a relatively new language, and it's the highest level of programming language ever created. Folks all over the world are using Julia to work on some very clever projects. Julia is currently being used for space exploration and robotics, life sciences research, climate modeling, finance and economics, data science, machine learning, supercomputing, quantum computing, and more. If your aspiration is to become a theoretical and or academic scientist to work on cutting edge research in math and or science, then Julia may be a good choice for you. On the other hand, if your aspiration is to become a professional software developer to work in industry to create commercial products and or services, then Julia may not be a good choice for you, at least not as a first language. If you find yourself in one of these lower tiers, you may be interested in my second channel, doggo.rs, which is dedicated to the Rust programming language. On that channel, I'm uploading a collection of short how-to videos to help you get started on your journey to learning how to write code using Rust. But whatever you decide to do, don't try to learn two languages at the same time, since it will get confusing. If you don't know what you want to do but would still like to learn a programming language, just flip a coin and pick one language and stick with it until you're comfortable using it. The reality is, no matter which path you decide to take, you'll eventually need to learn more than one language. And most programming languages are similar in concept, so once you're comfortable with one programming language, then the second programming language will be easier to learn. As for me, I am not a professional software developer, nor do I possess a computer science degree. I am not an expert in any particular programming language. I am a self-taught coding hobbyist who enjoys learning new things and enjoys making videos here on YouTube. Julia is my first programming language and I've been using it for about 3 years. I started this YouTube channel 3 years ago as a side project to help me learn Julia and as a way to help others who are interested in learning Julia with me. Even though it's only been 3 years, my "Julia for Beginners" playlist is already out of dates, so I'm launching this new series of videos in order to refresh my old content. This will provide some time for my regular viewers to catch up on some of my other videos. And it will give new students an opportunity to get started using the latest tools. By the end of this series, you won't be a Julia expert, but you'll have a very good idea if programming is right for you. And if you decide that you're interested in programming, then you'll also have a very good idea if Julia is right for you. Even if you conclude that programming and or Julia is not right for you, that's OK too. That means that you learn something about yourself. And in the end, self-discovery is really what education is all about. The hardest part of any educational journey is having the courage to take that first step. You're at the trailhead now, so it's not too late to turn back. But if you're ready to move forward, then let's get started. In the next chapter, you'll learn how to install Julia onto your computer. [swoosh] In order to download Julia onto your computer, start by going to the website, julianlang.org/downloads. As of this recording, the latest stable release version of Julia is version 1.9.3. Julia releases an updated version several times a year, so whenever you're watching this video, download the latest stable release. Select the installer for your operating system. In my case, I'm using a desktop computer running Windows 11, so I'm using the Windows 64-bit installer. Clicking on the link will download an installer executable file onto your hard drive. You can save this installer file anywhere, but by default, it will probably be saved in your downloads folder. I saved my installer file onto my desktop so you can see it on my screen. Double-click on this file and follow the instructions. This is optional, but here, check the box to "Add Julia to PATH". Checking this box will let you use Julia from your terminal. I'll show you what that means in another chapter. After the installation is complete, you should see a desktop icon with a Julia logo. If you see this icon, then congratulations! You have just installed Julia onto your computer. [kids cheering] This is what is known as a REPL, which is spelled "R-E-P-L". REPL stands for Read, Eval, Print, Loop. Eval is short for Evaluate. So the REPL reads your code, evaluates it, prints the appropriate response, and then waits for you to type in a new line of code. Thus, read, eval, print, loop. The REPL will let you use Julia interactively. In the next chapter, you'll learn how to use the REPL and you'll write your first line of code using Julia. [swoosh] Double-click on the shortcut icon to open the Julia REPL. You can adjust the size of the text in the REPL by using Ctrl-plus or Ctrl-minus. In the REPL, type in println(" Here you can type in anything that you want. By tradition, the first line of code that you write in any programming language is "Hello, World!". So that's what I'm going to type in here. Then type in "). And then hit Enter. [Tada!] If you see "Hello, World!" show up in the line below your code, then congratulations! You have successfully written your first line of code using Julia. Welcome to the club! [kids cheering] println means "print" then include a new line. No one refers to it as "print-l-n". Instead, you'll hear it referred to as "print line". So this line of code is read "print line, hello world". This code tells your computer to print whatever is in between the quotation marks and then include a new line after the printout. To exit the Julia REPL, either use the "x" in the upper right corner, Or type in "exit" immediately followed by a pair of parentheses. And then hit Enter. The REPL is a very handy tool that comes included with Julia. But some of you may prefer to use a computer terminal. So in the next chapter, you'll learn how to write Julia code using a terminal screen on your computer. [swoosh] I'm using a Windows PC, so these instructions are for Windows users. Click on the Windows Start button and type in "cmd" for "command". You should see the Command Prompt app show up. Click on the icon to open the Command Prompt app. The Command Prompt app is an old-school version of a Microsoft Terminal. You can adjust the size of the text on the screen by using Ctrl-plus or Ctrl-minus. At the prompt, type in "julia" and then hit Enter. This should bring up the Julia REPL inside of the Command Prompt app. From here, it works just like the freestanding Julia REPL. Type "println("Hello, World!")" and then hit Enter. You should see "Hello, World!" displayed on the line under your code. To exit the Julia REPL, type in "exit", immediately followed by a pair of parentheses, and then hit Enter. By doing that, you'll find yourself back in the Command Prompt app. To exit the Command Prompt app, either use the "x" in the upper right corner, or type in "exit" without the parentheses, and then hit Enter. So to exit the REPL, use "exit" with the parentheses, and to exit the Command Prompt app, use "exit" without the parentheses. In Windows, you have a second Terminal option called "Windows PowerShell", which is a modern version of the Command Prompt app. You can also use Julia inside of Windows PowerShell. To open Windows PowerShell, click on the Windows Start button and type in "power". You should see the Windows PowerShell app show up. Click on the icon to open Windows PowerShell. You can adjust the size of the text on the screen by using Ctrl plus or Ctrl minus. At the Prompt, type in "julia" and then hit Enter. This should bring up the Julia REPL inside of Windows PowerShell. From here, it works just like the freestanding Julia REPL. Type "println("Hello, World!")" and then hit Enter. You should see "Hello, World!" displayed on the line under your code. To exit the Julia REPL, type in "exit" immediately followed by a pair of parentheses, and then hit Enter. By doing that, you will find yourself back in Windows PowerShell. To exit Windows PowerShell, either use the "x" in the upper right corner or type in "exit" without the parentheses. So to exit the Julia REPL, use "exit" with the parentheses and to exit Windows PowerShell, use "exit" without the parentheses. Using either the freestanding REPL or using one of the terminal options, provide a quick way to get started playing around with Julia code. But a more sophisticated way to learn how to use Julia is to use a dedicated coding text editor, like VS Code. VS Code is a free coding text editor from Microsoft, which is a great tool to use to learn how to write code in a lot of different languages, including Julia. In the next chapter, you'll learn how to install VS Code onto your computer. [swoosh] In order to download VS Code onto your computer, start by going to the website code.visualstudio.com. Visual Studio Code is the official name for this app, but everyone calls it VS Code. The website should auto-detect your operating system. Click on the button to download the VS Code installer for your operating system. You can save the installer file anywhere, but by default it will probably be saved in your downloads folder. I saved my installer file onto my desktop, so you can see it on my screen. Double-click on this installer file and follow the instructions. This is optional, but here, I'm checking the box to create a desktop icon. This is also optional, but here, I'm unchecking the box to launch Visual Studio Code. After the installation is complete, you should see a shortcut icon with a VS Code logo on your desktop. If you see this shortcut icon, then congratulations! You have just installed VS Code onto your computer. [party horn] In the next chapter, you'll learn how to use Julia in VS Code. [swoosh] Double-click on the VS Code shortcut icon to launch VS Code. The first time you open VS Code, you'll be greeted by a welcome screen. If you see this dialog box in the lower right corner, you can click on the gear button to prevent this message from showing again. This is optional, but here, I'm going to select "Yes, Ignore All" to ignore all extension recommendations. For the color theme, feel free to select a color theme that you like. I'm going to stick with the default dark modern theme. Check this "Mark Done" link. Uncheck this box to "Show welcome page on startup". Close the "Welcome" tab by clicking on this "X". You can adjust the size of the user interface by using Ctrl plus or Ctrl minus. On the left-hand side are a set of large buttons. Click on the "Extensions" button to open the Extensions panel. The Extensions button is the button with 4 squares, with 1 of the squares being slightly offset. There are a lot of different extensions available for VS Code, but to use Julia in VS Code, you only need 1 extension. In the search bar, search for "julia". Install the "Julia" extension. Close the Extensions panel by clicking on the "Extensions" button again. You can read the description for the Julia extension at your leisure. For now, I'm going to close this tab by clicking on the "X". Click on the "Explorer" button to open the Explorer panel. The Explorer button is the top button along the left-hand side. The Explorer panel is where you will see all of your folders and files. You need to open at least one folder to begin using VS Code. I set up a folder earlier named "Series 10", so that's the folder that I'm going to select. But you can select any folder that you like. If you don't have a particular folder that you want to use, just select your Desktop folder. At the Warning dialog box, check the box to "Trust the Authors" and click on the "Yes, I trust the authors" button. To set up a new folder, click on the "New Folder" button. I'm going to set up a new folder named "Tutorial 10x06", but you can name it whatever you like. To set up a new file, be sure that the folder where you want to place your new file is highlighted, and then click on the "New File" button. I'm going to set up a new file named "hello.jl". You can name your file whatever you like, but be sure to save it with a ".jl" file extension. Using the ".jl" file extension, tells VS Code that this is a text file that contains code written in the Julia Programming Language. If you see this dialog box, click "Yes" to help the Julia team working on the Julia extension. Or if you're concerned about privacy, then click "No". If you see another dialog box, you can click the "X" in the upper right corner to close the box. Click on the "Explorer" button again and close the Explorer panel. Before you get started, turn on the "Auto-Save" option. Depending on the size of your user interface, you may see a "Hamburger Menu" button in the upper left corner. Clicking on the "Hamburger Menu" button, we'll bring up several options. From here, select "File", then "Auto-Save" to toggle on the "Auto-Save" option. You may need to scroll down to see the "Auto-Save Toggle" option. In the Editor, type in "println("Hello, World!")" and then hit Enter. Notice that the Editor highlights the code for you while you're typing. In addition, when you type in open parenthesis, it automatically gives you a closed parenthesis. Same thing for the double quotes. Even though this code is identical, to the code that you enter into the Julia REPL. when you hit Enter in VS Code, the code is not evaluated. [crowd booing] By default, there are 3 different ways to evaluate Julia code using the Julia extension in VS Code. Shift-Enter will evaluate a line of code, and then move the cursor to the next line of code. Ctrl-Enter will evaluate a line of code, but will keep the cursor at that line of code. And Alt-Enter will evaluate all of the code in the entire file. In this particular case, it doesn't matter which option you select, since there's only one line of code. But I typically use Shift-Enter, so that's what I'm going to do here. Place the cursor at the end of the line of code that you want to evaluate, and then hit Shift-Enter. The first time you try to evaluate code using the Julia extension in VS Code, a terminal window will open up and automatically launch the Julia REPL. When that happens, the Julia extension will do some stuff in the background, so there will be a noticeable delay. But you will eventually see "Hello World" appear in the REPL window. If you see "Hello World", then congratulations! You have successfully used Julia in VS Code. [kids cheering] In addition, you have successfully created and saved your first .jl file. For the rest of this tutorial series, you will use VS Code, along with the Julia extension, as your primary programming environment. To exit the Julia REPL, click on the REPL, then type in "exit", immediately followed by a pair of parentheses. In the Editor, place your cursor at the end of line 1 and hit Shift-Enter again. The REPL will reappear and you'll see "Hello, World!" again, except this time there won't be a long delay. So that covers the basics of using Julia in VS Code. In the next chapter, you'll learn how to perform basic math using Julia. [swoosh] Double-click on the shortcut icon to open VS Code. Open the Explorer panel and create a new folder for this tutorial. I'm naming my folder "Tutorial 10x07", but you can name your folder whatever you like. In your new folder, create a new file. I'm naming my file "math.jl". You can name your file whatever you like, but be sure to save it with a .jl file extension. Close the Explorer panel and be sure that the "Auto-Save" option is "On". VS Code will save your settings from your previous sessions, so if you turned on "Auto-Save" previously, it should still be "On". You can tell that it's "On" if you see that checkmark next to the "Auto-Save" option. Before getting to the math, here's how to write comments inside of a .jl file. To write a comment, start the line with a hashtag character, also known as the number sign or the pound sign. Comments are human-readable notes that you leave for yourself and for anyone else who may be viewing your code. Comments are ignored by Julia, so you can write whatever you like. If you prefer, you can use the keyboard shortcut Ctrl-forward-slash to convert a line of code into a comment. You can toggle the line back and forth between code and comment by using Ctrl-forward-slash multiple times. In Julia, there's a special syntax for multi-line comments. Start the multi-line comment using hashtag equal sign and end the multi-line comment using equal sign hashtag. All of the text in between will be considered a comment. Now that you know how to write comments, here's how to perform some basic math operations in Julia. Type in "1 + 1". Place the cursor at the end of the line and then hit Shift-Enter. The Julia REPL will launch automatically and you'll see the number 2 appear in both the REPL, as well as next to your line of code. Being able to see the result next to your code is one of the convenient features of using Julia in VS Code. For the most part, you won't need to refer to the REPL, but it will continue to run in the background. I'm going to reduce the size of the REPL window by clicking and dragging this horizontal bar. This will give me a little more room to see my code. When typing in "1 + 1", I had to include a space before and after the plus sign. Those spaces are called "whitespace". For the most part, Julia ignores "whitespace", so you can also write "1+1" without any "whitespaces". I'm going to be using Shift-Enter to evaluate my code, so I won't be constantly reminding you to hit Shift-Enter. You get the same result, but the code is a little harder to read in the Editor. There's a whole school of thought when it comes to the Coding Style Guide, which I won't get into, but as a general rule of thumb, you should use "whitespace" to improve the readability of your code for you and your fellow humans. But for the most part, Julia and your computer are indifferent whether or not you use "whitespace". For subtraction, use the minus sign character. For multiplication, use the asterisk character, also known as the star. For division, use the "forward slash" character. Notice that Julia returned 2.0 and not 2. There's a reason for this that I'll cover in a future chapter. Now try to divide 5 by 2. As expected, Julia returns 2.5. For exponents, use the "caret" character. Caret is spelled c-a-r-e-t and on most keyboards, it's Shift number 6. So this is the code for 2 to the 3rd power, or 2 cubed. The last basic math operator that I'm going to cover is the Modulo operator. The Modulo operator is the Percent Sign Character. If you're new to coding, this is an operation that you may not be familiar with. Even though the Percent Sign Character is used, this operation doesn't have anything to do with taking percentages. Instead, the Modulo operator returns the Modulus, which is the remainder of a division operation. So in this example, 5 divided by 2 equals 2 with a remainder of 1. That remainder of 1 is called the Modulus of the operation, which is what you see in the result. This line of code is read 5 Modulo 2, or 5 Mod 2. You may be wondering why this is even necessary to use, but it turns out that the Modulo operator is very useful in the coding world. Now, let's put some of these basic math building blocks together with an example to demonstrate the order of operations. This code is the Julia representation of the math equation that you see on the screen. So reading this equation from left to right, while disregarding the order of operations, this is read 1 plus 2 minus 3 to the 4th power times 5. If you punch these numbers and operators into a calculator, literally from left to right, you'll get 1 answer, but if you follow the order of operations, you'll get a different answer. So if you use a calculator, that's 1 plus 2, which is 3, then 3 minus 3, which is 0, then 0 to the 4th power, which is 0, and then 0 times 5, which is 0. So by using a calculator, moving from left to right, the answer is 0. Let's see what Julia comes up with. [drumroll] [crowd gasping] Julia comes up with 6, not 0. Why's that? The order of operations can be summarized using PEMDAS, which stands for Parentheses, Exponentiation, Multiplication and Division, Addition and Subtraction. As a mnemonic device, PEMDAS is sometimes referred to as "Please Excuse My Dear Aunt Sally". So rather than simply going from left to right, you follow this order of operations. In this example, the operation in the Parentheses is 2 minus 3, which is negative 1. The Exponentiation is negative 1 to the 4th power, which is positive 1. The Multiplication is 1 times 5, which is 5. And the Addition is 1 plus 5, which is 6. [Tada!] So that's the answer that Julia came up with. In order to get comfortable working with basic math in Julia, try writing your own code using different numbers and by combining the various operators. When you're done practicing, you can close out of the Julia REPL by clicking in the REPL. Then, you can either use exit immediately followed by a pair of parentheses, like you've done in the past, or you can use the keyboard shortcut Ctrl-D, as in doggo, which is what I'm doing here. You can close the file by clicking on this X. And you can close out of VS Code by clicking on this X. VS Code will save your UI settings, so you won't need to readjust them every time. So that does it for basic math. In the next chapter, you'll learn what a Boolean is and how to use them in Julia. [swoosh] In the coding world, a Boolean indicates whether something is true or false. Booleans are at the core of how programming languages get computers to perform tasks that require logical thinking. Double-click on the shortcut icon to open VS Code. Open the Explorer panel and create a new folder for this tutorial. I'm naming my folder "Tutorial 10x08", but you can name your folder whatever you like. In your new folder, create a new file. I'm naming my file "bool.jl". You can name your file whatever you like, but be sure to save it with a .jl file extension. Close the Explorer panel. In addition to launching the Julia REPL by using Shift-Enter on a line of code, you can launch the Julia REPL manually by using the keyboard shortcut "Alt-J" then "Alt-O". In the Editor, start by typing in "3 is less than 2". The "less than" operator is the open-angle bracket character. The "less than" operator is an example of a comparison operator, which compares the value of the number on the left-hand side, with the value of the number on the right-hand side. The result of a comparison operation is a Boolean value. There are only two possible Boolean values, true or false. This statement is false, since 3 is not less than 2. Place the cursor at the end of the line, and then hit Shift-Enter. Julia returns false, because the statement is false. False is the Boolean value, which is the result of this comparison operation. Now type in "3 is greater than or equal to 3", and then hit Shift-Enter. The "greater than or equal to" operator is the close-angle bracket character, immediately followed by the equal-sign character. Julia returns true, because 3 is greater than or equal to 3. Now type in "4 is equal to 3", and then hit Shift-Enter. That double equal sign is called the "equality operator". So this is read "4 is equal to 3". Since 4 is not equal to 3, this statement is false. The "less than" operator, the "greater than or equal to" operator, and the "equality operator" are all examples of comparison operators. There are several other comparison operators that I didn't cover, but conceptually they're all the same. They compare the value of a number on the left-hand side, with the value of a number on the right-hand side. You can combine these comparison operations with a Boolean operator. Like the comparison operators, a Boolean operator compares the value on the left-hand side with a value on the right-hand side. But unlike the comparison operators, a Boolean operator doesn't compare numerical values. Instead, the value on the left-hand side is a Boolean value, so either true or false, and the value on the right-hand side is also a Boolean value, so either true or false. There are two Boolean operators, the Boolean AND, as well as the Boolean OR. The Boolean AND operator is the ampersand character, also known as the AND sign, while the Boolean OR operator is the vertical bar character, also known as the vertical line or pipe. In Julia, there is also something called a "short-circuiting AND operator", as well as a "short-circuiting OR operator". The short-circuiting AND operator is the double ampersand, and the short-circuiting OR operator is the double vertical bar. Here are a couple of examples. The Boolean operation here is stating that the left-hand side is true and the right-hand side is true. Is that the case here? "Hmm..." The left-hand side is the comparison operation 1 is equal to 1, which is true. And the right-hand side is the comparison operation 1 is greater than 1, which is false. So only one side is true, so the overall Boolean statement is false, since both sides need to be true in order for the overall statement to be true. Place the cursor at the end of the line and then hit Shift-Enter to see what Julia comes up with. As expected, Julia returns a value of "false". The reason why the double ampersand is called a "short-circuiting Boolean operator" is because it starts by evaluating the left-hand side. If the left-hand side is false, then the operator immediately returns the Boolean value "false", since both sides need to be true in order to return a Boolean value of "true". If the left-hand side is false, then the operator won't even bother to evaluate the right-hand side. But if the left-hand side is true, then the operator evaluates the right-hand side. So the "short-circuiting AND operator" is a very efficient operator, since it doesn't do any unnecessary work. There's also a "short-circuiting OR operator", which is the double vertical bar. As an aside, the Editor is trying to be helpful by trying to autocomplete your words. If you hit Enter here, it will give you the wrong selection. To disregard the suggestion, use the "escape" key. With a Boolean OR operator, if at least one side of the operator is true, then the operator will return a Boolean value of "true". The only time it returns "false" is if both sides are "false". So in this example, the left-hand side of "1 is equal to 1" is "true", so the overall Boolean statement is "true". Since the left-hand side is true, the "short-circuiting OR operator" doesn't even bother to evaluate the right-hand side, since it doesn't matter whether the right-hand side is true or false. But if the left-hand side was "false", then the "short-circuiting OR operator" would evaluate the right-hand side to see if the right-hand side is true or false before returning a Boolean value. This may be a little confusing, so take your time to practice writing your own code using different scenarios until you're comfortable with how this works. Finally, in Julia, the Boolean values of "true" and "false" also have their own numeric values. "true" is equal to 1 and "false" is equal to 0. As a result, in Julia, you can use Boolean values like any other number. This is useful when you have a large collection of Boolean values. Rather than trying to count the individual "trues" and "falses", all you need to do is add them up to find out how many "trues" there are. In this example, we know there are two "true" values, since the result here is 2. When you're done practicing, click in the REPL and close it by using Ctrl-D. Close the file and close VS Code. So that's the basics of using Booleans. In the next chapter, you'll learn how to use variables in Julia. [swoosh] You may think that you know what a variable is, since you may have learned about them in math class, but this example will demonstrate that a variable is different in the coding world versus the math world. I'm in VS Code, where I've already created a new .jl file. I've also fired up the Julia REPL manually by using Alt-J, then Alt-O. In the Editor, type in "x is equal to 1, y is equal to 2, and z is equal to x + y. And then, use Shift-Enter to evaluate each line of code. So far so good. This looks like something you may have seen in Algebra class. Now type in "x is equal to 2", and then type in "y" and then "z". Before evaluating the new lines of code, predict what you think the value of "z" will be. [suspenseful music] If "x is equal to 2" and "y is equal to 2" and "z is equal to x + y" then z should equal 4, right? [suspenseful music] Now evaluate the new lines of code. [suspenseful music] [losing horn] The value of "z" is 3 and not 4. Why's that? This example demonstrates a fundamental difference between the math world and the coding world. In the math world, this is read "x is equal to 1". But in the last chapter, you'll learn that in Julia, the equality operator is the double equal sign and not the single equal sign. So what does it mean to use a single equal sign character in Julia? The single equal sign character is called the "Assignment Operator". The Assignment Operator assigns the value on the right-hand side to a name on the left-hand side. That name on the left-hand side is called the "Variable". The first time you use a variable name, that's called "Declaring a Variable". In some languages, declaring a variable and assigning a value to it are two separate steps. But in Julia, declaring a variable and assigning a value to it happen in the same step. So technically, this can be understood as "declare a variable named x and assign the value 1 to it". To add to the confusion, many coders don't refer to this as "declare a variable named x and assign the value 1 to it". Instead, many coders refer to this as "x is equal to 1", even though that's technically not accurate. I do the same thing as well, because it's too cumbersome to say "declare a variable named x and assign the value 1 to it". Technically, this can be understood as "declare a variable named y and assign the value 2 to it". Now, this is a little different. This may look like "z is equal to x + y" and coders may even refer to it as "z is equal to x + y". But what it really means is, declare a variable named "z", then use the value contained in the variable named "x", which is 1, and use the value contained in the variable named "y", which is 2, then evaluate 1 plus 2, which is 3, then assign the value 3 to the variable named "z". So after all of that, what's contained in the variable named "z" is the value 3 and not the equation "x + y". That's why, when you change the value assigned to the variable "x" later on, the value contained in "z" didn't change. If you want to update the value contained in "z", then you need to tell Julia to update it. Julia will not update this value for you automatically. Changing the value contained in an existing variable is called a "mutation", as opposed to an "assignment". So in this example, you're not declaring a new variable and assigning an initial value, since both a variable name and a value already exist. Instead, you're mutating the value contained in the existing variable named "x" from 1 to 2. Same thing here, you're not declaring a new variable and assigning an initial value, since the variable name and a value already exist. Instead, you're mutating the value contained in the existing variable named "z" from 3 to 4. This may be a little confusing, but this isn't a bug. Believe it or not, this is actually how your computer works. Understanding how your computer works is very important, so let's review. The double equal sign is the equality operator. But the single equal sign character is the "Assignment Operator". The Assignment Operator assigns a value on the right-hand side to a name on the left-hand side. The name on the left-hand side is the variable. The first time you use a variable name, that's called "declaring a variable". In Julia, declaring a variable and assigning a value to it are done in one step. The variable contains a value and not an equation, so the value won't update automatically. Changing the value contained in an existing variable is called a "mutation". So that's a lot of terminology to throw at you, but the terminology is not important. What's important is that you understand how your computer works, so take time to practice by writing your own code until you're comfortable with how this works. A common use for variables is for incrementing values. By convention, the lowercase letter "i" is used for the variable name for the incrementer, but you can use any name that you like. So here, this is declaring a variable named "i" and assigning the value "1" to it. In order to mutate the value contained in the variable named "i", you have a couple of options. In the math world, this is a nonsensical equation, since "i" cannot equal "i + 1", but in the coding world, this means something very different. This means, use the value contained in the variable named "i", which is "1", then evaluate "1 + 1", which is "2", then reassign, or mutate, the value contained in the existing variable named "i" from "1" to "2". This operation is used a lot, so there's a shorthand version of it. This does the same thing. The plus-sign character immediately followed by the equal-sign character is the updating version of the addition operator. So this code starts with a value contained in the variable "i", which is "2" at this point, and then mutates that value by adding "1" to it, which is "3". In Julia, you can use any of the basic math operators, not just the addition operator, immediately followed by the equal-sign character to get the updating version of that operator. Another common use for variables is to use them to perform basic math operations. A lot of times, it's easier to remember variable names, as opposed to trying to remember numeric values. In Julia, variable names are case-sensitive, but by convention, a variable name should be a single word written in all lowercase letters. As a best practice, when possible, variable names should be something descriptive, so the reader of your code can easily figure out how your variables are being used. Before I go, I want to show you a situation where you might want to use Ctrl-Enter, as opposed to Shift-Enter, to evaluate your code. If you go back up to the line with the updating addition operator, try using Shift-Enter again. The line re-evaluates, but the cursor moved down to the next line of code. If you want to keep the cursor at that line, place your cursor at the end of the line and use Ctrl-Enter. You can use Ctrl-Enter multiple times. Fun, right? So that's the basics of using variables in Julia. In the next chapter, you'll learn how to use different types of numbers in Julia. [swoosh] You may think that a number is just a number, but in the coding world, the number 1 is different than the number 1.0. Even though 1 and 1.0 have the same value, to your computer, 1 and 1.0 are two different types of numbers. Specifically, 1 is an example of an integer, meaning numbers like -2, -1, 0, 1, 2, etc. And 1.0 is an example of a floating-point number, meaning any number using a decimal point. One of the differences between Julia and other programming languages is that Julia offers a lot of different types of numbers that you can use. I won't be covering all of the different types of numbers available in Julia, but let's take a look at a few examples, so you can get a feel for working with numbers in Julia. I'm in VS Code and I've already created a new .jl file. And I've already launched the Julia REPL by using Alt-J, then Alt-O. Julia has a built-in Function named "typeof()" that will return the data type of a value. So by default in Julia, numbers like -3 are of type Int64, which is short for "64-bit Integer. Int64 is an example of a data type. And by default in Julia, numbers like 1.2 are of type Float64, which is short for "64-bit floating-point number". When using integers and floating-point numbers, you have the option of using different bit sizes for those types. Julia offers several different bit sizes, but in this chapter I'll focus on 64-bit numbers and 32-bit numbers for illustration purposes. The difference between 32-bit and 64-bit comes down to a trade-off between performance versus precision. 32-bit numbers require less memory. As a result, applications using 32-bit numbers will run faster. But because 32-bit numbers use less memory, they are also less precise, which may lead to errors in the long run. 64-bit numbers do require more memory, but using 64-bit numbers will allow your calculations to be more precise, making them suitable for many numeric computing and scientific computing applications. Casual users may not notice any difference between using 32-bit numbers versus using 64-bit numbers. But a situation where you may want to consider moving down from a 64-bit floating-point number to a 32-bit floating-point number is when you need to perform a high volume of floating-point math. Some examples include creating an animation of a simulation or training a machine learning model. Since these tasks require a high volume of floating-point math, there will be a noticeable difference in speed depending on whether you use 64-bit floating-point numbers versus using 32-bit floating-point numbers. When declaring a new variable, you can also declare the data type of the value contained in that variable. To declare the data type for a variable, use the double colon immediately following the variable name, then immediately followed by the data type. So in this example, you're declaring a new variable named "example" and assigning the value 1.2 to it. At the same time, you're asserting that the value contained in this variable is a 32-bit floating-point number. This will override Julia's default 64-bit floating-point number designation. Now, here's an interesting example of floating-point math. "Oof!" In the human world, 0.1 plus 0.2 is 0.3, but for your computer, it's not that simple. Because your computer has a binary brain, it can only understand 0's and 1's. So your computer is great when it comes to integers, but it struggles with any number between 0 and 1. To your computer, any value between 0 and 1 is just an estimate, which is why it's important to use 64-bit floating-point numbers if you require precision. Speaking of values between 0 and 1, Julia also supports rational numbers, also known as fractions. So in this example, 1 divided by 3 is 0.3 repeating, which is a 64-bit floating-point number. But if you use the double forward slash character, that will generate the fraction 1 over 3. You can perform basic math operations using rational numbers, just like you can with any other number. So in this example, this is 1 3rd plus 1 7th, which is 10 over 21. Julia also supports irrational numbers. Perhaps the most famous irrational number is pi, so the value of pi is built into Julia. To round a number, Julia provides the round() Function. I'll cover Functions in more detail in a later chapter, but in this example, the round() Function contains 2 arguments. The first argument is the value that you want to round. And the second argument, which is separated by a semicolon, is called a keyword argument, that tells Julia how many digits you want your result to be. For large numbers, you can use the underscore character to make your large numbers more readable. So in this example, both the left-hand side and the right-hand side have a value of 1 million. But it's a lot easier to see that the right-hand side is 1 million. Julia ignores the underscore character when used in a number. In addition to providing all of these different data types for numbers, Julia also provides a lot of built-in math Functions for your convenience. I'll show you one example. This returns the square root of a number. Before ending this chapter, I want to revisit the chapter on basic math. Recall that 4 divided by 2 returns 2.0, which is a floating-point number, instead of 2, which is an integer. That's because in Julia, the division operator always returns a floating-point number. An integer plus an integer will always be an integer. An integer minus an integer will always be an integer. An integer times an integer will always be an integer. But an integer divided by an integer will sometimes be an integer and sometimes be a floating-point number. Julia needs to know how much memory to allocate for the result before evaluating the code. So by default, Julia uses the worst-case scenario, which is a 64-bit floating-point number. For integer division, Julia provides the div() function. The div() function returns the quotient of the division operation, which will always be an integer. Julia also provides a Unicode character for the div function, which you can display by using backslash div followed by the tab key. This operator does the same thing as the div() function and it provides the perfect segue into the next chapter. So that's the basics of using different types of numbers in Julia. In the next chapter, you'll learn how to use characters and strings in Julia. [swoosh] I'm in VS Code and I've already created a new .jl file. And I've already launched the Julia REPL by using Alt-J, then Alt-O. Like numbers, characters and strings are data types in Julia. For characters, use a pair of single quotes or apostrophes. C-h-a-r is short for "character", but many coders refer to this as "char". For strings, use a pair of double quotes. You've seen the string data type before when you enter your first line of code. So the difference between a character and a string is that a character can only be a single character. But a string can be a collection of characters. When creating strings, sometimes you need to display the quotation mark character. For this, Julia offers a couple of options. You can either use backslash quotation mark within the pair of quotation marks for the println() function, the output is the output is displayed in the REPL. Or, you can use quotation marks within a pair of triple quotation marks for the println() function. It does the same thing. To display new lines, use backslash-n To display tabs, use backslash-t. To concatenate strings, use the "star" character. To interpolate a string within a string, use the "$" character. Julia also supports Unicode characters, including emojis. To generate a Unicode character, start with a backslash, enter the Unicode character name, and then use the Tab key. So the lowercase Greek letter Alpha is backslash-alpha-tab. Here you need to generate the Unicode character before using the single quotes. And the dog emoji is backslash-colon-dog-colon-tab. In Julia, these are character data types, so you can use them just like any other character. Pretty cool, right? Now, even though this is a lot of fun, as a best practice, you should try to avoid using Unicode characters if you're writing code that other humans might need to read. Not every programming environment supports Unicode characters, and not everyone may appreciate your creativity. But if you're writing code for yourself, then Julia provides a lot of flexibility for you to express yourself however you like. You can find a list of Unicode characters in the Julia documentation. One of the exceptions to this rule of thumb of trying to avoid the use of Unicode characters is when you need to use Unicode characters for well-known, irrational numbers, like pi and Euler's number. As you saw in the last chapter, Julia has the value of pi built-in, which you can access by using pi. But you can also access it by using the lowercase Greek letter for pi, which you can generate by using backslash-pi-tab. Julia also provides the value for Euler's number, which you can access by using backslash-euler-tab. Unlike pi, there's no non-Unicode version for Euler's number in Julia. So you have to use the Unicode character for it. So that's the basics of using characters and strings in Julia. In the next chapter, you'll learn what an array is and how to use them in Julia. [swoosh] So far, you've seen several different data types, including integers, floating-point numbers, characters and strings. While these are useful on their own as individual pieces of data, at some point, you may want to organize your data into a collection so that your data is easier to manage. In the coding world, a collection of data types is called a "data structure". To add to the confusion, a data structure is also a "data type". Different programming languages use different naming conventions for their data structures, so it's important to understand how these data structures work in these languages, as opposed to getting hung up with their names. In Julia, an example of a commonly used data structure is the array. In Julia, an array is a very flexible data structure for organizing your data. Let's take a look at some examples. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. And I've adjusted my user interface so that my REPL window takes up roughly half of my screen. In Julia, an array can have any number of dimensions. In Julia, a one-dimensional array is called a "vector", also known as a "column vector". To construct a column vector, use a pair of square brackets. In between the square brackets, enter your data, separated by commas. The individual pieces of data are called "elements". In the REPL, you'll see the numbers 1, 2 and 3 displayed in a column. In the Editor, you'll see that the data type for the value assigned to the variable named "col_vector" is a "Vector", with elements of type Int64. In Julia, the data type, called "Vector", is just an alias for a one-dimensional array. That's what that 1 means here at the end. To construct a row vector, follow a similar workflow. But when you enter your data, separate your data with blank spaces only, and don't include the commas. In the REPL, you'll see 4.0, 5.0 and 6.0 displayed in the same row. Back in the Editor, you'll see that in Julia, a row vector is really a "Matrix", which is an alias for a two-dimensional array. Dimension 1 being the number of rows, and dimension 2 being the number of columns. So here, 1 by 3 means a Matrix with one row and three columns. The other thing to note here is that you can also declare the data type of the elements in a Julia array, by including the data type immediately before the open square bracket. In this example, you're asserting that the elements of this array are of type Float32. This will override Julia's default Float64 designation for floating-point numbers. To access an individual element in an array, use square brackets immediately following the variable name. Within the square brackets, include the index number. In the coding world, depending on the programming language, indexing is either 0-based or 1-based. 0-based indexing means that the initial element is index 0, and the second element is index 1, and so on. 1-based indexing means that the initial element is index 1, and the second element is index 2, and so on. Julia uses 1-based indexing. In this example, you're accessing the second element in the column vector, which is a 64-bit integer with a value of 2. You can also mutate the value of any element in a Julia array. In this example, you're mutating the value contained at index 2 of this column vector from 2 to 20. In the REPL, you'll see that the column vector now displays 1, 20 and 3, instead of the original 1, 2 and 3. To find the length of a vector, Julia provides the "length()" Function. While this may not be that useful for this simple example, this Function comes in handy for very large Vectors. To add up the value of all of the elements in a Vector, Julia provides the "sum()" Function. Again, this may not be that useful for this simple example, but it's extremely useful for large Vectors. To sort the elements within a Vector, Julia provides a couple of options. To sort the elements of a Vector non-destructively, use the "sort()" Function. To sort in descending order, use the keyword argument "rev = true". In the REPL, you'll see the Vector is displayed in descending order by value. But if you call the variable name for the column vector, you'll see that nothing has changed. If you want to make the Sort permanent, use the "sort!()" Function. In the Coding World, the exclamation mark is referred to as "bang". By convention in Julia, using a "bang" at the end of a Function name informs the user that this Function is a destructive Function that's mutating your input data "in-place". In the Coding World, the term "in-place" means that the input data itself is being manipulated in some way, and no copy of the original data is being retained. Using an "in-place" Function is a very efficient way to handle your data. But using it also means that you won't be able to get your data back into its original form, so you need to be careful when you use them. As you can see in the REPL, the variable named "col_vector" is no longer the original Vector. Sometimes you want to do this, and sometimes you don't. So Julia provides you with these options. In Julia, not only can you mutate the values of the elements and the order of the elements, but you can also mutate the size of the Array as well. To add a new element to the end of a Vector, use the "push!()" Function. By using the "push!()" Function, the variable named "col_vector" grew from 3 elements to 4 elements by adding the value 100 to the end of the Vector. To remove the last element in a Vector, use the "pop!()" Function. By using the "pop!()" Function, the variable named "col_vector" shrank from 4 elements to 3 elements by removing the last value of 100. To construct a Matrix with 2 rows and 3 columns, start by constructing a Row Vector, and then separate each new Row by using a semicolon. In the REPL, you'll see a Matrix with 2 rows and 3 columns. To access an element in a 2-dimensional Array, use the Row Number and the Column Number, separated by a comma, for the Index. So in this example, you're accessing the value at Row 1, Column 3, which has a value of 5. In addition, you can access the elements by using an Index Number following Column Major Order. In the Coding World, Matrices are either Row Major Ordered or Column Major Ordered. Row Major Order means that the Index Numbers start at Row 1, Column 1, and then goes to Row 1, Column 2, and so on. After reaching the end of the Row, the Index Number goes to Row 2, Column 1, and then goes to Row 2, Column 2, and so on. Column Major Order means that the Index Numbers start at Row 1, Column 1, and then goes to Row 2, Column 1, and so on. After reaching the bottom of the Column, the Index Number goes to Row 1, Column 2, and then goes to Row 2, Column 2, and so on. Julia uses Column Major Order, so you can index a Matrix using this concept. In this example, the 5th element has a value of 5, because the Index Numbers follow this Column Major Order zigzag pattern. This final example will demonstrate the extreme flexibility of the Julia Array. One of the differences between Julia and other programming languages is that in Julia, you can combine different data types within the same array. So in this example, this Column Vector contains an Integer, a Floating Point Number, a Rational Number, an Irrational Number, a Character, a String, and an Array. [crowd gasping] Notice that the Data Type, or the Elements in this Vector, is Type "Any". In Julia, the Data Type "Any" is the most general form of a Data Type. Even though this is possible to do in Julia, as at best practice, when constructing Arrays, you should try to use the same Data Type for all of the Elements in that Array. Doing so will reduce the amount of memory required for your Programs, which will improve their performance. With that said, if you ever need to mix and match Data Types within an Array, Julia does offer you that flexibility. So that's the basics of using Arrays in Julia. In the next chapter, you'll learn what a Tuple is and how to use it in Julia. [swoosh] In the last chapter, you saw how amazing and flexible the Julia Array can be. But using all of those features requires a lot of memory, which may affect the performance of your Programs. Sometimes you just want a simple, memory-efficient way to handle your data. That's when a Tuple comes in handy. As a side note, this Data Structure can be pronounced either "Toople" or "Tuple". I'm going to be referring to it as a "Toople". With that said, let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. And I've adjusted my User Interface so that my REPL window takes up roughly half of my screen. To construct a Tuple, use a pair of parentheses, as opposed to a pair of square brackets. So this is an example of a Tuple with three elements of type "String", Int64 and "String". Like an Array, you can access an element in a Tuple by using an index number. But unlike an Array, you cannot mutate the value of any element in a Tuple. [error sound] You'll get an error message if you try to mutate the value of a Tuple element. In addition, the order of the Tuple element is immutable. [error sound] You'll get an error message if you try to sort a Tuple. Also, you cannot mutate the size of a Tuple. [error sound] You'll get an error message if you try to mutate the size of a Tuple. So compared to an Array, a Tuple is not very flexible. [crowd booing] But here's something interesting that you can do with a Tuple. [crowd gasping] In the Coding world, what you just witnessed is called a "Destructuring Assignment". So rather than having a single variable name on the left-hand side of the Assignment Operator, this example has a Tuple, which contains three new variable names as elements of that Tuple. On the right-hand side is an existing variable name, which also happens to be a Tuple that contains three elements with existing values. Using the syntax, we'll assign the first element in the Tuple on the right-hand side to the variable name in the first element in the Tuple on the left-hand side. And so on. By doing this, you can now refer to the values in the original Tuple by variable names, as opposed to using index numbers. Pretty cool, right? Even though this is useful, there's actually an easier way to refer to Tuple elements by name. You can use something called a "NamedTuple", which is the subject of the next chapter. [swoosh] I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. And I've adjusted my user interface so that my REPL window takes up roughly half of my screen. When constructing a Tuple, you have the option of using a name for each element of that Tuple. Doing so will construct something called a "NamedTuple", meaning that each element of that Tuple has a unique name associated with it. To access an element in a NamedTuple, you can use an index number, just like you can with a Tuple. "Boring!" Or, you can use the name of the element by using the variable name for the NamedTuple, followed by a dot, then the element name. [Tada!] Depending on your data, it may be easier to refer to your data by name, rather than using an index number. But like a Tuple, a NamedTuple is immutable, so you can't change any of the element values, you can't sort it, and you can't change the size of the NamedTuple. With that said, both the Tuple and the NamedTuple provide a memory-efficient way to store and retrieve your data if you don't need the flexibility of an Array. So that's the basics of using a NamedTuple in Julia. In the next chapter, you'll learn what a Dictionary is and how to use it in Julia. [swoosh] In the last chapter on NamedTuples, we used a "name" to identify the value of an element. In the coding world, this is an example of a key-value-pair, where a "key" is used rather than an index number to access the value of your data. Depending on the nature of your data, it may be easier to retrieve your data by using a name, rather than a number. While the NamedTuple is a great data structure for small datasets, it becomes less efficient for large datasets. As your datasets grow larger, you may want to use a different type of data structure that can store and retrieve data using a key-value-pair, whose performance is independent of the size of your data. For those cases, you may want to consider using a Hash Table. Depending on the programming language, this data structure is referred to by different names. The Julia implementation of the Hash Table data structure is called a "Dictionary". Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. And I've adjusted my user interface so that my REPL window takes up roughly half of my screen. To construct a Dictionary, use the Dict() constructor. For key-value-pairs, the key goes on the left-hand side, and the value goes on the right-hand side. In between is the Pairs operator, which maps the key to the value. The Pairs operator is spelled P-A-I-R-S, and it's the equal-sign character immediately followed by the greater-than-sign character. Now, I'm not suggesting that you follow my example, but just for demonstration purposes, I wanted to show that the key can be any data type, and the value can also be any data type. As a side note, the data type with a colon immediately before it is an example of a Julia data type called a "Symbol". I haven't covered this data type before because this data type is not common in other programming languages. In Julia, a "Symbol" is a data type that looks like a String, but somehow, magically, doesn't take up any memory. "Wow!" Because of its unique characteristic, you'll see the Symbol data type used in Julia in situations where a String may be used in other languages. For example, in Julia, a Symbol data type is often used as a key. Whether you realized it or not, the names in the NameTuple are "Symbols" and not "Strings". The usage of the Julia Symbol is more advanced, so it's beyond the scope of this beginner series. But I wanted to include the Symbol in this example so you can at least see it in action. In the REPL, you'll see the Dictionary displayed with three entries. Note that the data type is "Dict", with the keys of type "Any" and the values also of type "Any". A Dictionary is an unordered collection, so it may be displayed in a different order than the order in your code. Because it's unordered, you can't sort a Dictionary. To access the values stored in your Dictionary, use square brackets immediately following the variable name of your Dictionary. In between the square brackets, enter the key. You can combine this syntax with the assignment operator to mutate the value associated with that key. Note that the new value does not need to be the same data type as the original value. To see the mutated Dictionary, use the variable name for your Dictionary. You'll see the updated Dictionary in the REPL. To add a new key-value-pair entry, use the same syntax, but use a new key in between the square brackets. In the REPL, you'll see that your Dictionary now has four entries. Also note that the new entry is displayed in a random position, since the Dictionary is an unordered collection. To remove a key-value-pair entry, use the pop!() function. The first argument is the variable name for your dictionary, and the second argument is the key that you want to remove. In the REPL, you'll see that your Dictionary now has three entries. Interesting, right? Now that you've seen Tuples, Arrays and Dictionaries, here's how to think about these data structures. Tuples are extremely efficient at storing and retrieving your data. But they are the least flexible, so you should only consider using them for small data sets. Dictionaries provide a nice balance between efficiency and flexibility, so they can be used for many different applications. But as your data set grows larger, it may take longer to access your data. Dictionaries offer a solution for large data sets, since due to the nature of Hash Tables, the amount of time it takes to retrieve data is independent of data size. But dictionaries require more memory up front than either a Tuple or an Array, so it's not ideal for small data sets. So that's the basics of using a Dictionary in Julia. In the next chapter, you'll learn what a struct is and how to use it in Julia. [swoosh] So far, you've seen examples of Tuples, Arrays and Dictionaries, which are all data structures that are defined by Julia. But did you know that you can create your own custom data structure? My friend, let me introduce you to the "struct". "Ooh!" In Julia, a struct is a user-defined collection of named fields. For each named field, you can define the data type for that field. "Wow!" Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. And I've adjusted my user interface so that my REPL window takes up roughly half of my screen. To declare a struct, use the "struct" keyword in all lowercase letters, followed by the name of your struct. By default, structs in Julia are immutable, so use "mutable struct" if you want the ability to change the values of the fields. By convention, the name of your struct should begin with an uppercase letter. Place the field names on separate lines, but you don't need to separate them using commas. If you don't declare a data type for the field, Julia will assign it the data type "Any". To close the struct declaration, be sure to include "end". As a side note, the data type "Integer" is a general data type covering all of the different types of integers available in Julia. When you hit Shift-Enter, nothing happens. That's because all you did was declare your custom data structure and made it available for use in memory. To create a struct, use the name of your struct as the constructor. And then, enter the values in the same sequence as the named fields, separated by commas. As you're typing, note that VS Code is reminding you what the field names are for your struct. What you just created is called an "instance" of your struct. Note that the data type of this instance is not "struct". The data type is "Dog", which is the name of your custom data structure. So not only have you created your own custom data structure, you've also created your own custom data type. To access the value of a struct field, use the same syntax that you used for a NamedTuple. Start with a variable name, followed by a dot, then followed by the field name. This is another example of a key-value-pair, where you access the value by using a key rather than an index number. Note that in VS Code, when you hit the dot, the available field names will appear as options for your convenience. Pretty cool, right? Because you defined this as a mutable struct, you can mutate the value of any field, as long as the new value is of the same data type defined in your struct. But a mutable struct only means that you can mutate the values of the fields. Even if the struct is mutable, you cannot add a new field to a struct. "Oof!" You'll get an error message if you try to do that. When it comes to data structures, as a beginner, you should learn to use Arrays, Tuples NamedTuples and Dictionaries until you're comfortable with them. But after gaining some experience, you may find it that it's more convenient to define your own custom data structures. That's when you should consider using structs. So that's the basics of using a struct in Julia. The next chapter will introduce the concept of Control Flow, and will begin a series of chapters covering different examples of Control Flow Tools available in Julia. [swoosh] One of the great things about a computer is that you can program it to perform many different tasks for you. But in some cases, you don't want your computer to perform all of those tasks at the same time. Instead, you may want your computer to perform certain tasks only if certain conditions are met. And in other cases, you may want your computer to perform a single task, but to repeat that task multiple times. You as the programmer are able to determine which tasks are performed, in which order they're performed, and for how long they're performed, by using a set of tools collectively referred to as Control Flow. Control Flow introduces the concept of logic and automation, which are a couple of key concepts that differentiate your computer from other machines. Over the next several chapters, we'll explore some of the built-in Control Flow Tools that come included with Julia. Let's start with an example of a conditional evaluation. I'm in VS Code and I've already created a new .jl file. And I've also launched the Julia REPL by using Alt-J and Alt-O. Conditional evaluation is a Control Flow Tool that tells your computer to perform a certain task only if certain conditions are met. Let's start by setting up some scenarios, also known as conditions. Before you execute these lines of code, let's talk about them. The first line of code is an example of destructuring assignment using tuples. In Julia, using the parentheses is "optional" for destructuring assignment. So this line of code is the same as this line of code with the parentheses. The first line is declaring a variable named "x" and assigning the value "1" to it. In addition, it's declaring a variable named "y" and assigning the value "2" to it. The next line of code is another example of destructuring assignments using tuples without the parentheses. The second line of code will swap the values between the variables "x" and "y", so that the value contained in the variable named "x" will mutate from 1 to 2. And the value contained in the variable named "y" will mutate from 2 to 1. This last line of code will mutate the value contained in the variable named "x", the value contained in the variable named "y". In other words, the value contained in the variable named x will mutate from 2 to 1, so that both x and y are equal to 1. For now, let's comment out the last two lines of code and only execute the first line of code, so that x equals 1 and y equals 2. Recall that you can toggle the comments on and off by using Ctrl- forward slash. Now let's set up 3 different tasks for your computer to perform. In Julia, you can assign a Function to another Function name, just like you can with variables. The only difference is that you need to include a set of parentheses at the end of the new Function names. When you hit Shift-Enter for each line, nothing happens. I'll explain what "generic Function with one method" means in a future chapter. For now, what you need to know is that you just created 3 new Functions named Task1, 2 and 3, and made these new Functions available for use in memory. Now comes the fun part. You don't want your computer to perform all 3 tasks at the same time. What you really want is to set up a Conditional Evaluation, so your computer can use some logic to determine which task to perform. In Julia, you have a couple of options when it comes to Conditional Evaluation. One option is to use the "if" expression. To create an "if" expression, use "if", "elseif", "else", "end". After "if" and "elseif", include a Conditional Statement that will evaluate either True or False. Now before hitting Shift-Enter, let's talk about this code and try to anticipate what's going to happen. So in English, this code can be read "If x is greater than y, then perform Task1", else "If x is less than y, then perform Task2", otherwise "perform Task3". Here's the visualization of the code. Based on this diagram, your computer can use logic to determine which task to perform. In the current scenario, x is equal to 1 and y is equal to 2, so x is less than y. Based on this code, your computer should perform Task2. Task2 is a function that will display "1 is less than 2". Let's execute the code to see what happens. As predicted, in the REPL, you'll see the output "1 is less than 2". Now let's go back up to the top of the code and swap the values between the variables x and y. The output "(2, 1)" means that the value contained in the variable named x has mutated from 1 to 2, and the value contained in the variable named y has mutated from 2 to 1. In other words, the values have been swapped. Now let's go back down to the "if" expression to predict what will happen. Since the value contained in x is now greater than the value contained in y, then this code should perform Task1. Let's rerun the "if" expression to see what happens. In the REPL, you'll see "2 is greater than 1", so the "if" expression works. It performs a different task based on a different condition, so there's no need for you to re-write your code for different conditions. Now, let's go back up to the top of the code and try the third condition. Since the value contained in the variable named y is 1, this code mutates the value contained in the variable named x from 2 to 1. In other words, both x and y are equal to 1. Now let's go back down to the "if" expression to predict what will happen. Since x is not greater than y, and x is not less than y, then this code should perform Task3, since there's no other option. Let's rerun the "if" expression to see what happens. In the REPL, you'll see "1 is equal to 1", so the "if" expression worked again. It performed a third task based on a third condition, while using the same code. Pretty cool, right? Now when you're using an "if" expression, only the "if" and "end" keywords are required. Using "else" and "elseif" are optional. But using "if", "elseif", "else", "end" will allow you to account for a lot of different conditions, so this syntax is a handy one to have in your toolkit. So that's the basics of using an "if" expression in Julia. In the next chapter, you'll learn what a "Ternary" operator is, and how to use it in Julia. [swoosh] This is the syntax for a "Ternary" operator, where "a" is a conditional statement that evaluates either true or false. If the statement is true, then "b" is evaluated. If the statement is false, then "c" is evaluated. When the question mark character is used with the colon character separated with spaces, that's called a "Ternary" operator. That's because this operator requires 3 operands, a, b and c, unlike most other operators that only require 2 operands, like the addition operator. When using the "Ternary" operator, using a space before and after is required around both the question mark character and the colon character. Using the "Ternary" operator is another example of conditional evaluation. The behavior of the "Ternary" operator is just like the "if" expression from the last chapter. Only the syntax is very different. Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. And I've also launched the Julia REPL by using Alt-J, then Alt-O. Let's start by setting up the same 3 conditions and the same 3 tasks that we used in the last chapter. Evaluate the first condition only, and then evaluate the three tasks using Shift-Enter. Using the ternary operator will give you the same results as using an "if" expression, but you can get that result by using a single line of code. Now before hitting Shift-Enter, let's talk about this code. Starting on the left-hand side, "x is greater than y" is a conditional statement that will evaluate either true or false. If the conditional statement is true, then the code after the question mark is evaluated. If the conditional statement is false, then the code after the colon is evaluated. The ternary operator is meant to have only three operands, but you can include another ternary operator nested within a ternary operator by using a pair of parentheses. So that last expression is a nested ternary operator, which allows you to include another conditional expression. Even though the syntax is very different, behavior-wise, it's the same as using "if", "else if", "else", "end". Now hit Shift-Enter to see what happens. In the REPL, you'll see "1 is less than 2", which is the same result that you got when using the "if" expression. Now let's go back up to the top of the code and swap the values between the variables "x" and "y". Now rerun your ternary operator code to see what happens. In the REPL, you'll see "2 is greater than 1". So the ternary operator works. It performs a different task based on a different condition, just like an "if" expression. Now go back up to the top of the code and try the third condition. Now rerun your ternary operator code to see what happens. In the REPL, you'll see "1 is equal to 1". So the ternary operator worked again. It performed a third task based on a third condition. Pretty cool, right? Now even though this is fun, as a beginner, you should learn to use the "if" expression until you're comfortable using it. The ternary operator is not available in all programming languages, but the "if" expression is commonly used in other languages. So it's worth spending the time to learn how to use the "if" expression first. But after gaining some experience, you can use the ternary operator as a shorthand form of the "if" expression for conditional evaluations in Julia. So that's the basics of using a ternary operator in Julia. In the next chapter, you'll learn what a "while loop" is and how to use it in Julia. [swoosh] In the last two chapters, you saw examples of conditional evaluation, where your computer performs a certain task based on a certain condition, and then it stops. But in some cases, you may want your computer to keep repeating a task or a set of tasks, as long as a certain condition is true. Once the condition is false, only then do you want your computer to stop. For those cases, you want to use a control flow tool called a repeated evaluation, or a loop. The "while loop" is an example of a repeated evaluation, in the form of a conditional loop. The "while loop" will repeat a task or set of tasks, as long as a condition is true. Once the condition is false, then the computer stops. Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. And I've adjusted my user interface so that my REPL window takes up roughly half of my screen. Let's start by declaring a variable named "i" and assigning the value 1 to it. By convention, the lowercase letter "i" is used for an incrementing counter. To create a "while loop", use the keywords "while" and "end". After "while", enter a conditional statement that will evaluate either true or false. In between "while" and "end", include a task or set of tasks that you want your computer to repeat while the condition is true. Now before hitting Shift-Enter, let's talk about this code. At the moment, the variable named "i" contains the value 1, so the conditional statement "i" is less than or equal to 10" is true. Since the condition is true, this code tells your computer to display the value 1 and then mutate the value contained in the variable named "i" from 1 to 2. And then the code repeats. The variable named "i" now contains the value 2, so the conditional statement "i" is less than or equal to 10 is still true. Since the condition is still true, this code tells your computer to display the value 2 and then mutate the value contained in the variable named "i" from 2 to 3, and so on. This code will repeat until the value contained in the variable named "i" is no longer less than or equal to 10. Let's run the code to see what happens. In the REPL, you'll see the numbers 1 through 10. Pretty cool, right? Now, you have to be careful when using the while loop. Since the while loop will keep repeating as long as the conditional statement is true, you need to make sure that the condition becomes false at some point if you want it to stop. Otherwise, your computer will be stuck in an infinite loop. If you get stuck in an infinite loop, you can break out of it by clicking in the REPL terminal window and using Ctrl-C. Since this code keeps incrementing the value contained in the variable named "i", "i" will always be greater than or equal to 10, so this code will never stop repeating. So that's the basics of using a while loop in Julia. In the next chapter, you'll learn what a "for" loop is and how to use it in Julia. [swoosh] Like the while loop, the "for" loop is another example of a repeated evaluation control flow tool. But unlike the while loop, the "for" loop doesn't use any conditional statements. With the for loop, you, as the programmer, tell your computer how many times you want it to repeat a task, or set of tasks. Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. For the next few chapters, I'm going to dock my REPL next to my Editor. You can move the Julia REPL by clicking and dragging the Julia REPL tab, and then dropping it somewhere else in the user interface, when an available space is highlighted. To create a for loop, use the keywords "for" and "end". Now before hitting Shift-Enter, let's talk about this code. In Julia, 1 colon 10 is called the "range object". The first number is the starting number in the range, and the second number is the ending number in the range. The range includes both the starting number and the ending number. What's implied in the syntax is that the step size in between the first number and the second number is positive 1. In other words, this syntax means the range of integers 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10. By convention, the lowercase letter "i" is used for the variable name for the range object, but you can use any name that you like. Also, notice that we did not declare this variable name before creating the for loop. That's because this variable named "lowercase i" exists only in this for loop. In other words, it's created by the for loop, used by the for loop, and then discarded, so it ceases to exist once the for loop has ended. [explosion] In between the "range object" and the keyword "end" is the task, or set of tasks, that you want your computer to repeat. Now hit Shift-Enter to see what happens. In the REPL, you'll see the integers 1 through 10, inclusive. This is the same output that you got when using a while loop, but the for loop was able to do it using less code. In addition, the for loop only repeats a task, or set of tasks, for the number of times in the range, so there's no risk of an infinite loop. On the flip side, the for loop is merely doing what it's told to do. There's no logical thinking involved, since there are no conditional statements. So those are the main differences between a for loop and a while loop. The for loop is a very efficient form of automation, that you can use if you know, in advance, how many times you want your computer to repeat a task. The while loop is not as efficient as the for loop, but the while loop is a more sophisticated form of automation, that allows your computer to decide on its own, when to stop performing a task, based on a certain condition. The while loop is a good choice if you don't know, in advance, how many times you need your computer to repeat a task. One of the keys to using the for loop is understanding how the range object works. So let's take a look at a couple more examples. Here, I'm copy and pasting the code by using Ctrl-C and Ctrl-V. In this example, the range object has 3 numbers, separated by colons. Like in the first example, the first number is the starting number in the range, inclusive. The last number is the ending number in the range, inclusive. The number in between is the step size. So 0 colon 5 colon 50, means the integer's 0, 5, 10, etc. and ending with 40, 45 and 50. This is optional, but before hitting Shift-Enter, I'm going to clear my REPL window by clicking on the REPL tab, and then using Ctrl-L. Using Ctrl-L in the REPL just clears the display. It doesn't clear anything from memory. OK, now back in the Editor, you can hit Shift-Enter. In the REPL, you'll see the integer's 0 to 50 using a step size of positive 5. Now the step size doesn't need to be a positive number. In Julia, you can use a negative number for the step size. Let's take a look at that example next. Again, you can copy and paste this code. When using a negative step size, be sure that the starting number in the range is larger than the ending number in the range. Like before, I'm going to clear the REPL window by using Ctrl-L, and then hit Shift-Enter in the Editor. This time in the REPL, you'll see the integers from 1 to 10 in descending order. Pretty cool, right? So that's the basics of using a For Loop by using a Range Object. In the next chapter, you'll learn how to use a For Loop to loop over a collection, without using a Range Object. [swoosh] When using the For Loop, you have the option of looping over a collection, rather than using a Range Object. Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. In addition, I've docked my REPL window next to my Editor. Let's start by setting up a small Array to use as an example. To loop over the elements in this Array, you can use a For Loop. But rather than using a Range Object, you can use the syntax "for element in collection". The variable name for the element can be any name. But the Collection name has to refer to an existing Collection. In this example, the name of the Collection is "myarray". Also notice that the word "in" is used, rather than the equal sign character. In Julia, when using a For Loop, you have the option of using either the equal sign character or the word "in". By convention, when creating a For Loop in Julia, the equal sign character is used with a Range Object, and the word "in" is used to loop over a Collection. But, they do the same thing inside of a For Loop, so in practice, you'll see the equal sign character and the word "in" used interchangeably by Julia developers. This is optional, but I'm going to clear my REPL window by using Ctrl-L. And then, I'm going to use Shift-Enter to run this code. In the REPL, you'll see the elements of the Array displayed. You can use this concept to loop over other types of Collections in Julia. For example, in Julia, a String is just a Collection of individual Characters, so you can loop over a String as well. Before hitting Shift-Enter, I'm going to clear my REPL window by using Ctrl-L. And then, I'm going to hit Shift-Enter in the Editor. In the REPL, you'll see all of the individual Characters in the String displayed in a Column. Pretty cool, right? You can also use this concept to loop over the Keys and the Values in a Dictionary. For the variable names for the Key-Value-Pairs, use a Tuple when creating the For Loop. Like before, I'm going to clear my REPL window by using Ctrl-L. And then, I'm going to hit Shift-Enter in the Editor. In the REPL, you'll see a nicely formatted display of the Key-Value-Pairs in this Dictionary. In summary, the For Loop is both an efficient and versatile version of the repeated evaluation Control Flow Tool. You can use it either with a Range Object, or you can use it to loop over a Collection. But since conditional statements are not involved, you should use a For Loop only if you know in advance how many times you want your computer to repeat a task. So that's the basics of using a For Loop to loop over a Collection without using a Range Object. This concludes the mini-series on Control Flow in Julia. [sad music] In the next chapter, you'll learn what a Comprehension is, and how to use it in Julia. [swoosh] In Julia, a Comprehension is a shorthand way of constructing an Array. The subject of Comprehensions really should have been covered in the chapter on Arrays, but you need to know how to use a For Loop before you can use a Comprehension, which is why I'm covering it now. Here's the syntax for a Comprehension. Like any other Array, the elements are placed in between a pair of square brackets. But rather than inserting individual elements, you use a For Loop to populate your Array. The expression can be something simple, like the numbers in the Range. Or it can be something more sophisticated, like an equation that uses the numbers in the Range as inputs. Following the expression is the header of the For Loop. So it's just the keyword "for", followed by a variable name, the equal sign character, and then the Range Object. When using a Comprehension, there is no need to use the keyword "end". Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. In addition, I've docked my REPL window next to my Editor. Now before hitting Shift-Enter, let's talk about this code. In this example, "i" to the 3rd power is the expression. "i" is the variable name for the numbers in the Range Object. And "1 colon 10" is the Range Object, meaning the integers from 1 to 10, inclusive. So the expression is the task that your computer will repeat using each number in the Range. Your computer will place the results of these calculations inside of an Array. Now hit Shift-Enter to see what happens. In the REPL, you'll see a display of a 10-element vector, with elements of type Int64. Recall that a Vector in Julia is just an alias or a 1-dimensional array. The value of each element is the number in the Range raised to the power of 3. Pretty cool, right? You can index this array just like any other array. So the 7th element in this array has a value of 343, which is the same as 7 cubed. Fun, right? So that's the basics of using a Comprehension in Julia. In the next chapter, you'll learn what a Function is, and how to use it in Julia. [swoosh] Functions are the principal building blocks of Programs, because they allow the Programmer to take advantage of the concepts of Abstraction and Decomposition. Abstraction means that the user of the Function doesn't need to know how the Function works in order to use it. And Decomposition means that the Programmer can break up a large Program into a collection of smaller Functions, making software easier to write, debug, and maintain. println() and typeof() are examples of Functions that come included with Julia. As a user, you don't need to know how these Functions work in order to use them. And you don't need to recreate these Functions every time you want to use them. But as a budding Software Developer, the real power of Functions is that you can create your own custom Functions, either for yourself or for others. This definition is from the Julia documentation. "In Julia, a function is an object that maps a tuple of argument values to a return value." Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. To create a Function, use the code block "function...end". Before hitting Shift-Enter, let's talk about this Code. After the word "function", is the Function name, immediately followed by a pair of parentheses, just like a tuple. Inside of the tuple are the Function parameters, separated by commas. In between the words "function" and "end" is the body of the Function. By default, the Function returns the last line of code that is evaluated. In this example, the name of the Function is "myadd". When naming Functions use the same naming convention for variables by using lowercase letters. This Function maps the values for x and y to the expression "x plus y", and then evaluates "x plus y", and then returns the value of "x plus y". Now hit Shift-Enter to see what happens. What just happened is known as declaring and defining a Function. In some programming languages, declaring and defining a Function are two separate steps. But in Julia, declaring and defining a Function happen at the same time. All you really did was make this code available in memory, so that Julia can use it at some point in the future. I'll explain what "generic" Function with one method means in the next chapter. To use this Function, type in the Function name, immediately followed by a pair of parentheses, and enter two numbers, separated by a comma, just like a tuple. And then hit Shift-Enter. Next to the code, you'll see the return value of 3, which is the same as 1 plus 2. "Ooh!" What just happened is known as calling a Function. In Julia, the first time you call a Function, Julia will find the Function definition in memory, and then compile that code into something that's machine readable. You may not have noticed it in this simple example, but with more complex Functions, you may notice a slight delay the first time you call a Function. That's because Julia compiles the Function definition code the first time you call the Function, and not when you declare and define it. The next time you call that Function, there won't be a delay. The other thing to point out here is when you call a Function, the inputs to the Function are referred to as "arguments". But when you declare and define a Function, the inputs are referred to as "parameters". This can be confusing, so in practice, many coders use the terms "parameters" and "arguments" interchangeably when it comes to Functions. Within the Julia community, the term "parameter" often means something different. So when it comes to declaring, defining, and calling Functions, the term "arguments" is used for the Function inputs. That's probably more information than you need to know, so let's change subjects. In addition to using the function...end block of code, you can declare and define a Function in Julia using a shorthand form that looks closer to the form that you may have seen in Math class. In this example, the name of the Function is the lowercase letter "f". This Function "f" takes two arguments, "a" and "b". Julia maps these arguments to the expression, which is from the Pythagorean Theorem, to calculate the length of the hypotenuse "c" of a right triangle given the lengths of the two sides "a" and "b". After evaluating this expression, this Function will return the value of this expression. Let's call this Function to see what happens. This Function returns the value "5", which is the length of the hypotenuse of a right triangle with the sides of lengths 3 and 4. Pretty cool, right? In general, the concept of Functions is common to most programming languages, but each programming language has their own way of implementing Functions. It is at this point that the various programming languages begin to diverge. Until now, the subjects covered in most of the previous chapters are common to many other programming languages. But starting from here, you'll begin to see some of the features that differentiates Julia from other languages. So that's the basics of using a Function in Julia. In the next chapter, you'll learn what Multiple Dispatch is, and how to use it in Julia. [swoosh] One of the features of Julia that sets it apart from other languages is something called Multiple Dispatch. Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. Let's start by declaring and defining a Function named "mytypeof()". This Function takes a single argument of type Int64 and returns the String "Int64". The keyword "return" is used when you want to be specific about what the Function should return. In many cases, using the keyword "return" is not required. But I'm using it in this example to make it clear to the reader that this Function is returning this String. Note that this is a generic Function with one method. I'll explain what that means in a few minutes. Because I declared a data type for the argument in this Function definition, this Function will only work if the argument used is of type Int64. In Julia, you have the option of reusing the Function name, but using a different data type for the argument. This gives you the ability to change the Function's behavior based on the data type of the argument. Note that this is now a generic Function with two methods. In Julia, every Function is referred to as a generic Function. According to the Julia documentation, "A generic Function is conceptually a single function, but consists of many definitions, or methods. In object-oriented languages like JavaScript and Python, the term "method" means a Function tied to some Object. In Julia, the term "method" means something very different. This is also from the Julia documentation. "A definition of one possible behavior for a function is called a method". So in this example, the Function "mytypeof()" has two methods, which means that there are two possible behaviors for this Function. Julia will determine which method to use based on the data type of the argument. Let's add one more method to the "mytypeof()" Function, which will serve as a catch-all for all other data types. OK, so now the "mytypeof()" Function has three methods. So three possible behaviors for this Function, depending on the data type of the argument. In other programming languages, reusing a Function name, while using different data types for the Arguments in the Function definition, is called Function Overloading. But the term Function Overloading is often confused with the term "Multiple Dispatch", but they're not the same thing. Let's take a look at an example of Multiple Dispatch. In this Function declaration and definition, a data type was not declared for the Function arguments. In many other programming languages, this would not be allowed. In many other programming languages, you need to specify the data type for all Function arguments. Otherwise, you'll get an error message. But in Julia, you can declare and define truly generic Functions that can be used with any data type, thanks to "Multiple Dispatch". In Julia, the term "Multiple Dispatch" means that Julia will dispatch the most appropriate method based on the data types of all of the Function Arguments at the time the Function is called. Julia will then compile that one method and evaluate it. Julia will ignore all of the other methods. In this example, mygenericfunction() will determine which method to call for the "mytype()" Function based on the data type of the argument in mygenericfunction(). Let's try calling mygenericfunction() using several different data types. In the REPL, you'll see the output "1 is type Int64". Now let's try using an irrational number. In the REPL, you'll see the output "pi is type number". The mytypeof() Function doesn't have a method for an irrational number. So Julia picks the closest method, which is the method using the Number data type. Let's try one more example using an Array. This time in the REPL, you'll see the output "[1, 2, 3]" is type "not defined yet". The mytypeof() Function doesn't have a method for an Array. Also, an Array is not a number, so Julia picks the closest method, which is the method using the "Any" data type. So you get 3 different behaviors when using 3 different data types for the Function argument, while using a generic Function that never declared a data type in the Function definition. If you're new to programming, this may seem logical and not that impressive, but trying to create truly generic Functions is very difficult to do in other programming languages. In Julia, it's relatively easy to create generic Functions, thanks to multiple dispatch. The other thing that multiple dispatch allows you to do is to create a custom data type, add a new method using that custom data type, and then reuse the generic Function without making any modifications to that code. Let's take a look at an example. So in this example, you're creating a new struct with one field. Using this custom data type, you can add a new method to the Function mytypeof(). The Function mytypeof() now has 4 methods. This creates a new instance of your custom data type. And now, you can reuse the generic Function using this instance. In the REPL, you'll see the output "Dog("eggdog")" is type Dog. Note that we did not have to modify the Function definition of my generic Function, nor did we have to re-evaluate it before calling it again. Thanks to multiple dispatch, Julia was able to figure out which method of the mytypeof() Function to call, based on the data type of the argument in my generic Function. So why is this important? This goes back to the concepts of Abstraction and Decomposition. Multiple Dispatch is a higher level of abstraction compared to Function Overloading. Multiple dispatch gives you the ability to create truly abstract generic Functions. At the same time, multiple dispatch gives you the ability to break down your projects into smaller pieces of reusable code. In this example, imagine that one person in one part of the world is a developer who is maintaining a list of the different methods for the mytypeof() Function. And imagine that another person in another part of the world is a developer who is maintaining the mygenericfunction() definition. And imagine that a third person in a third part of the world is a user and not a developer who wants to use my generic Function, but wants to use it with their own custom data type that no one else will ever use. Thanks to multiple dispatch, this third person can define a new method for the mytypeof() Function just for their own custom data type. Then this third person can call mygenericfunction() without making any modifications to it. And the code will just work. [Tada!] This imaginary scenario is a high-level oversimplification for how the Julia ecosystem works. And it's made possible in large part thanks to multiple dispatch. Before I go, I want to show you the methods() Function. The methods() Function will display a list of the different methods available for any Function. So the mytypeof() Function currently has 4 different methods, or 4 possible behaviors for this Function, depending on the data type of the argument. While the mygenericfunction() Function currently has 1 method, so it has the same behavior regardless of the data type of the argument. In Julia, the arithmetic operators are also Functions. So the addition operator, or the plus sign, is a Function. In Julia version 1.9.3, the addition operator has 207 different methods. If you maximize the REPL window, you can scroll through and see all of the different methods available for the addition operator. These are different methods for different combinations of different data types for the operands. Because someone has already done this work, this is why you are able to create the myadd() Function in the last chapter, without having to declare any data types in the Function definition. The myadd() Function from the last chapter is an example of a generic Function with 1 method that can take arguments of any data type. Based on the data types of the arguments, Julia will use multiple dispatch to figure out which of the 207 methods to call for the addition operator. One of the technical differences between multiple dispatch and Function Overloading in other languages is that in Function Overloading, you need to pre-compile all of the different behaviors in advance, whether you use them or not. In Julia, Julia does not pre-compile all of the different methods in advance. Julia will only compile the 1 method that it needs at the time that the Function is called. So that may have been a little too much for a beginner's course, but that's the basics of using multiple dispatch in Julia. In the next chapter, you'll learn what an Anonymous Function is and how to use it in Julia. [swoosh] In Julia, you can create Functions that can take another Function as an argument. In the Coding World, a Function that takes one or more Functions as arguments is known as a higher-order Function. In many cases, when using a higher-order Function, it doesn't make sense to take the time to declare and define a new Function, just to use it once as an argument in some other Function. In those cases, it's handy to use something called an Anonymous Function, which is a Function that doesn't have a name. Let's take a look at an example. I'm in VS Code and I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. In addition, I've modified my user interface so that my REPL window takes up roughly half of my screen. Let's start by setting up a Vector with 3 elements of type String. The map() function is an example of a built-in, higher-order Function that comes included with Julia. The first argument is a Function, and the second argument is a Collection. The map() function applies the Function to each element in the Collection. The length Function returns the number of elements in a Collection. So in this example, the map() Function returns a new Vector containing the number of Characters in each of the 3 Strings. length() is a built-in Function provided by Julia. But what if you want to use your own custom Function with a map() Function? Before hitting Shift-Enter, let's talk about this code. In this example, the first argument is called an "Anonymous Function". This "x" before the arrow is the Function argument. The expression after the arrow is the body of the Function. So this syntax is a shorthand way of defining a Function without using a function...end block, and without using a Function name, hence an Anonymous Function. This code will apply this Anonymous Function to each element in the Collection. Now hit Shift-Enter to see what happens. In the REPL, you'll see a new Vector where the original elements now have the word "Doggo" added to them. [crowd gasping] So that's the basics of using an Anonymous Function in Julia. In the next chapter, you'll learn how to use Julia's Standard Library. [swoosh] Until now, all of the code that you've seen is from Julia Base, which provides many useful Functions that you may need on a day-to-day basis. But Julia also comes included with a Standard Library, which provides many more useful Functions, but ones that you may not need on a regular basis. In its most basic form, a Library is just a collection of Functions that someone else has already written and optimized, so you can just reuse their code without having to reinvent the wheel. In the Julia documentation, you can find a list of the Standard Libraries. I'll be honest, I haven't used all of these Libraries, but I'm going to show you how to use a couple of the Libraries that I use frequently. The Random Numbers Library, and the Statistics Library. Let's start by taking a look at the Random Numbers Library. I'm in VS Code where I've already created a new .jl file. I've also launched the Julia REPL by using Alt-J, then Alt-O. In addition, I've docked my REPL window next to my Editor. In Julia Base, there's a Function named rand(), which generates Random Numbers between 0 and 1 inclusive, using a uniform distribution. If you use an integer as the argument, the rand() function will return that amount of Random Numbers contained in a Vector. Because these Numbers were generated randomly, these Numbers will be different every time. And my Numbers will be different than your Numbers. But sometimes, you want to be able to recreate these so-called Random Numbers. So how can you recreate Random Numbers if they're generated randomly? "Hmm..." Well, it turns out that computer-generated Random Numbers are not actually Random. They just appear to be Random. You can recreate these so-called Random Numbers if you know the Random Seed that was used to create them in the first place. Using Julia, the Random Seed function can be found in the Random Numbers Library. To access any of Julia's standard libraries, type in the keyword "using" followed by the name of the Library. The name of the Library will begin with an uppercase letter. In this case, the name of the Library is "Random", starting with an uppercase "R". This code makes the functions contained in the Random Library available for you to use. The function that we need is named "seed!()", and you can call it by using this dot notation. For the function argument, you can use any integer, but if you use the same number that I'm using, you should get the same result as me. I'm going to clear my REPL display by clicking on the REPL tab, then hitting Ctrl-L. Then I'm going to hit Shift-Enter in the Editor. In the REPL, you'll see a new Vector with 10 new Random Numbers. But the difference is that you should see the same 10 numbers on your computer. [crowd gasping] So that's pretty useful. Another useful Library is the Statistics Library, so let's take a look at that next. Let's start by generating a Vector containing 1000 Random Numbers using a Normal Distribution, by using the randn() function, as opposed to the rand() function. A Normal Distribution is a Distribution with a Mean of 0 and a Standard Deviation of 1. To calculate the average value of the numbers in this Vector, you can declare and define your own custom function. And then you can call your function. But a more convenient way to solve this problem is to use the functions that come included with the Statistics Library. The Statistics Library provides a function named "mean()", which calculates the average value in a collection. Note that this value is the same as the value that you calculated using your own custom function. But you didn't need to declare and define a new function, all you had to do was reuse someone else's function that's already been optimized for Julia. The Statistics Library also comes included with many other functions that are common to the Statistics Domain, like median() and std(). So this dataset has a Mean value and a Median value that's pretty close to 0, and a Standard Deviation that's pretty close to 1, which are characteristics of a Normal Distribution. You can find a list of all of the functions available in any of the Standard Libraries in the Julia documentation. So that's the basics of using Julia's Standard Library. In the next chapter, you'll learn how to use external packages in Julia. [swoosh] Now that you know how to use Julia's Standard Library, you now have access to many more functions that are not included in Julia Base. But you can expand your access to even more functions by using external packages written in Julia. As of this recording, there are over 10,000 Julia packages available for you to explore. You can find a search tool to help you explore all of these different packages at the JuliaHub website. To give you an idea of how to use an external package in Julia, I'm going to show you a demonstration of how to use the Plots Package, which is one of the Data Visualization Packages available in Julia. Bear in mind this is not meant to be a Plots Tutorial, but rather a demonstration of how to use external packages in general. Before adding a new package, it's important to do some file management. I'm in VS Code, but I haven't created a new .jl file yet. Nor have I launched the Julia REPL. In the Explorer panel, create a new folder for this tutorial inside of your main project directory. I'm naming my folder "Tutorial 10x27", but you can name it whatever you like. Inside of the new folder, create a new .jl file. I'm naming my file "external_package.jl", but you can name it whatever you like. Now launch the Julia REPL by using Alt-J, then Alt-O. And then maximize the REPL window. The pwd() function will print the current working directory. In my case, my current working directory is somewhere on my desktop. You need to change your working directory to the new folder that you just created. You can change directories from the Julia REPL by calling a cd() function. Enter the folder's name inside a pair of double quotes. If you call the pwd() function again, you should see that your current working directory has updated. Now that you're in the correct directory, you can enter the Package Manager, which is Julia's built-in tool to help you manage external packages. You can enter the Package Manager by hitting the "closing square bracket" key on your keyboard. You should see the prompt change, indicating that you are now in the Package Manager. The first thing that you need to do is to activate your current working directory by entering the word "activate", followed by a space, then a dot. And then hit Enter. This tells the Package Manager that your project is located in this directory. Also, note that the prompt has changed. To add a new package, use the word "add", followed by the package name. Like in the Standard Library, names of external packages begin with an uppercase letter. For today's demonstration, I'm adding the Plots Package. Depending on your computer and on your internet connection, the Plots Package may take a few minutes to load. What's happening is that Julia is pulling a bunch of files off the internet and saving them onto your hard drive. And then, Julia is precompiling some of those files. After the Package Manager has finished, you can exit the Package Manager by hitting "backspace". In the Explorer panel, there will be two new files, Manifest.toml and Project.toml. The Project.toml file contains a list of all of the external packages loaded for this project. In this case, there's only one package named "Plots". The Manifest.toml file contains a list of all of the dependencies that are required to use the Plots Package. Dependencies are mainly code and version numbers from other packages that are being reused by the Plots Package. This file contains over 1,000 lines, so the Plots Package has a lot of dependencies. I'm showing you these .toml files just for your reference. You typically won't need to use them, nor should you try to modify them manually. These files are being used by Julia in the background. Now that everything's loaded, you can access the Plots Package, just like you accessed the standard library, by typing in the keyword "using", followed by the package name. In Julia, this is a plot. This is not a graph. In Julia, the term "graph" refers to "graph theory", which is something very different. The main function of the Plots Package is a function named "plot()". That's "plot" in all lowercase letters without an "s" at the end. The plot() function is a higher-order function, which accepts a function as an argument. Let's start by declaring and defining a cubic function, like something you may have seen in math class. In Julia, 2x is the same as 2 times x. To generate a plot of this function, all you need to do is enter the name of this function, which is the lowercase letter "f", as the argument in the plot() function. The Plots Panel should open up in VS Code, and you should see an image of your function. Pretty cool, right? This is what the default plot looks like. But this plot is endlessly customizable. You can customize the look of this plot by including various attributes in the form of keyword arguments in the plot() function. Don't worry too much about understanding all of these attributes today. I'm showing you this code just to give you a feel for what a plotting recipe looks like when using the Plots Package. This is the same function, but the plot looks very different, because of all of the different plotting attributes that we added in the second plot. You can flip back and forth between the two Plots by using these arrows in the Plots panel. By default, the Plots Package will generate a Line plot. Another useful plot is a Scatter plot, which you can generate by using the scatter() function. Let's start by generating some random numbers using a normal distribution. Using a random seed is optional. To generate a scatter plot of these data points, enter the Vector containing the x-values and the Vector containing the y-values separated by a comma. And then enter some plotting attributes in the form of keyword arguments. In the Plots panel, you should see 1000 data points clustered around the origin, or point (0, 0). Pretty cool, right? You can save any of these Plots to disk by using the Save button. This will save the plot as an SVG file, which is a vector graphic file format. You can open up an SVG file using any web browser. Because this is a vector graphic file, you can enlarge it to any size without losing any image quality. If you're interested in data visualization, there are several other plotting packages available in the Julia ecosystem. I have several videos on this channel on data visualization, but there are many resources available online when it comes to plotting packages in Julia. So have fun exploring! In addition to data visualization, there are Julia packages for all sorts of interesting subjects, including, but not limited to, differential equations, data analysis, machine learning, probabilistic programming, and much, much more. "Wow!" Some of these packages were created by the core Julia developers, but the vast majority of external packages were created by members of the Julia community, who volunteered their precious time, in the evenings and weekends, to share their knowledge with the rest of the community. So please keep that in mind when using their free software. And please try to show your appreciation for their generosity and for all of their hard work. So again, this wasn't meant to be a Plots tutorial, but that's the basics of using an external package in Julia. The workflow for adding other external packages is similar to the process that you saw today, although the detail of using the other packages will be different from package to package. In the next chapter, you'll learn how to use Pluto, which is another external package available in Julia. [swoosh] Pluto is a browser-based, reactive notebook programming environment created for Julia. Not only is it a powerful tool, but it's also a lot of fun to use. This video is not intended to be a comprehensive tutorial on how to use Pluto, since that's a very large subject. In fact, I have 3 other videos on this channel that covers how to use Pluto in more detail. But by the end of this video, you'll know how to install Pluto onto your computer and you'll know how to get started. To install Pluto, don't open up VS Code. [buzzer] Instead, launch the Julia REPL. In the Julia REPL, enter the Package Manager by hitting the closing square brackets. In the Package Manager, type in "add Pluto". After Pluto has loaded, exit the Package Manager by hitting Backspace. Exit the REPL by hitting Ctrl-D. Relaunch the Julia REPL. In the REPL, type in "import Pluto". Then type in "pluto.run()". Be sure to include the parentheses. The default web browser on your computer will open up to a welcome page. Don't close the Julia REPL, let it continue to run in the background. On the welcome page, you'll find several, very helpful notebooks that will provide you with a great introduction to Pluto. I'll let you go through these notebooks at your leisure. In the latest version of Pluto, there are also some advanced notebooks for you to explore later on, when you get more comfortable using Julia and using Pluto. For today, go back up to the top of the page and click on the button to create a new notebook. Since this is just a web browser page, you can use the same key bindings to adjust the browser window. You can maximize the browser window by hitting F11. You can use Ctrl-plus or Ctrl-minus to increase or decrease the magnification. In the blank cell, type in the Julia code for "Hello, World!". In Pluto, there are 3 different ways that you can evaluate code in a cell. If you prefer to point-and-click, you can use this Run Cell Arrow button in the lower right corner of the cell. You should see "Hello, World!" displayed below the cell. To add a new cell, click on the plus button in the lower left corner of the cell. You need to hover over the corner to make the button visible. To delete a cell, click on this button at the right of the cell and choose "Delete Cell". You need to hover over the button to reveal it. Add a new cell again and copy and paste the code from above using Ctrl-C and Ctrl-V. If you prefer to use the keyboard, the second way to evaluate code is to use Shift-Enter. Shift-Enter does the same thing as the Run Cell Arrow button. Add a new cell and paste the "Hello, World!" code again. Adding a new cell manually every time can get tedious, so there's a third way to evaluate code in Pluto. This time, hit Ctrl-Enter. Ctrl-Enter evaluates the cell and then gives you a new blank cell. "Brilliant!" For the most part, I use Ctrl-Enter when I'm using Pluto. Before going any further, save this file by going up to the header and clicking in the "Save Notebook" bar. You can save your file anywhere and you can name it whatever you like, but be sure to save it with a .jl file extension. Once you hit Enter or click on the "Choose" button, Pluto will auto-save this file anytime you make a change to it. Next, let's take a look at a Julia comment. I used Ctrl-Enter here, but there's no output. Although you use the println() function and comments frequently in VS Code, these are not the best ways to provide documentation inside of a notebook environment. Instead, a better way is to use Markdown. To use Markdown, begin the cell using "md", immediately followed by a pair of double quotes. Anything inside of the quotation marks will be displayed as Markdown text. To generate a header, start the quote with a hashtag character. One hashtag is the largest header size and six hashtags is the smallest header size. The difference between Markdown and a comment is that with Markdown, you can hide the cells containing the code and the Markdown text will still appear. You can hide cells in Pluto by clicking on the icon to the left of the cell that looks like an eye. You have to hover over the icon to make it visible. Note that the comment is no longer visible. You can make a cell visible again by clicking on the visibility icon again. Next, let's take a look at an example of reactivity. In an earlier chapter using VS Code, when you mutated the value of x from 1 to 2, the value assigned to z did not mutate automatically. Let's see what happens when you mutate the value of x in Pluto. To mutate the value of x, I'm using Shift-Enter so I don't get a new cell. Notice that the value of z updated automatically. [crowd gasping] This can be very powerful, but this power comes with some constraints. Because Pluto is a reactive environment, variables can only be declared and assigned in one cell. In this notebook, you can't have another cell where x equals 10 or y equals 20. If you want to mutate the value of a variable, you have to do it in the original cell. [crowd booing] This may seem a bit restrictive, but these constraints allow you to use widgets to make your experience more interactive. The Pluto widgets can be found in the PlutoUI Package. Pluto has a built-in Julia Package Manager, so you don't need to worry about file management when using packages inside of Pluto. This code will declare a variable named lowercase-letter-a and bind a slider widget to it. The slider will have a range from 1 to 10 inclusive with a step size of 0.1. This optional keyword argument will display the current value assigned to the variable named lowercase-letter-a. You can use the same code to bind a slider widget to a variable named lowercase-letter-b. Now, you can use these values for more calculations. When you move these sliders, the value assigned to the variable named lowercase-letter-c will mutate automatically. [crowd gasping] You can also move these cells up or down without impacting the calculations. To move a cell, drag and drop these space to the left of the cell. "Wow!" In addition to standard Markdown, you can also display "LaTeX", also known as "Math Mode", by including "LaTeX" inside a pair of dollar sign characters, within the Markdown quotation marks. You've seen this function before, but here's how to generate the "LaTeX" version of it. "LaTeX" is just typesetting, so this function doesn't actually work. "LaTeX" is a very large subject on its own, so I won't be covering it anymore in this video, but this will give you an idea of how it's used in Pluto. You can also use other external packages in Pluto. Here's how the "Plots" package works inside of Pluto. Depending on your computer and on your internet connection, it may take a few minutes for the "Plots" package to load. After it's done loading, declare and define a version of the "LaTeX" function that will work in Julia. And then, plot this function. [heavenly music] When you're done with your session, you don't need to worry about saving your file, since it's auto-saved for you, but you do have several other options for exporting your file if you're interested. If you click on this "Export" icon in the very top right corner, you'll see several different ways to export your file. I use this "Static HTML" version a lot. The "Static" version is not interactive, so when you move these sliders, they don't mutate any values. But the file does contain all of your code and all of your plots, and you don't need to wait for any of the packages to load. Back in the live version of your Pluto notebook, close out of these export options by clicking on this "X". To close out of Pluto, you can just "X" out of it. To close out of the Pluto session in the Julia REPL, click Ctrl-C, and then exit the Julia REPL by using the "exit()" function or by using Ctrl-D. The next time you want to access your notebook, go back into the Julia REPL and type in "import Pluto", and then "pluto.run()". At the welcome page, you can open up your notebook file with a .jl file extension by using the "Open a Notebook" bar. In the latest version of Pluto, your notebook will open up in "Safe Preview" mode. In "Safe Preview" mode, you can view the raw code, but the code will not be evaluated. To evaluate all of the code in this notebook, click on the "Run Notebook Code" button. After clicking that button, Pluto will evaluate all of the code in the notebook, including loading any external packages. Once it's done running, you should have your old notebook back, just like you left it. [harp music] [Tada!] So that was a whirlwind tour of Pluto. But this wasn't meant to be an exhaustive Pluto tutorial. Just a little glimpse to give you a feel for what Pluto's all about. So in addition to VS Code, you now have another programming environment to add to your ever-expanding Julia tool kit. In the next chapter, you'll learn how to update to the latest version of Julia. [swoosh] I started recording this series a few months ago. Since then, a new version of Julia has been released. There are several different ways to update Julia, but in this video, I'm going to show you one of the ways to update to the latest version of Julia. I'm currently using Julia version 1.9.3. But as of this recording, the current stable release is version 1.9.4, according to the download page of Julia's official websites. The version number contains 3 numbers separated by a decimal point. If the third number changes, that indicates a patch release, or a relatively small change. With a patch, it's generally not necessary to update versions. But if the middle number changes, that indicates a minor release. With a minor update, it's generally recommended to update versions. If the first number changes, that indicates a major, breaking release. With Julia, this first number took roughly 10 years to change, from version 0 to version 1. So a major version release is a pretty rare event. Even though it's not required, I'm going to update my version of Julia to the latest version, so you can see the workflow for updating Julia. To update Julia manually, there are only two steps. One, uninstall Julia. And then, two, reinstall Julia. I'm using Windows, so to uninstall Julia, I use the Windows Apps Manager, which you can find under Windows > Settings > Apps > Installed Apps. In the search bar, search for "julia", and uninstall the version of Julia that you're currently using. In my case, it's Julia version 1.9.3. Uninstalling will remove this Julia version from my hard drive and remove it from my environment path. It will also remove the shortcut icon for the REPL from my desktop. After it's done uninstalling, you can reinstall Julia, just like you did when you first installed it, by going to the download page at Julia's official website. Once you've seen this workflow before, I'm going to go through this part a little quicker. For Julia version 1.9.4, I'm downloading the Windows 64-bit installer executable file onto my desktop. Then, I'm executing the installer by double-clicking it. During the installation process, I'm checking the box to "Add Julia to PATH". And that's it! After the installation is complete, you should see a new shortcut icon for the Julia REPL using version 1.9.4. You can see the version number here in the REPL. Any package that you installed previously using version 1.9 should still be there. You can see a list of the current packages by typing in "status" in the package manager. In my case, the Pluto package that was used in a previous chapter is still here after updating to the latest version of Julia. The Julia version used in VS Code will update automatically the next time you open VS Code. I'm using the "hello.jl" file from chapter 6 as a test. And opening up the Julia REPL by using "Alt-J", then "Alt-O". You can see the Julia version number here in the REPL tab. The other way to check the version number is to use the versioninfo() function in the REPL. In the Editor, I'm using Shift-Enter to evaluate this line of code. If you see "Hello, World!" in the REPL, then congratulations! You have successfully updated to the latest version of Julia. "Woohoo!" So that's one way to update to the latest version of Julia. In the next chapter, you'll learn where to find help when using Julia. [swoosh] In this video, I'm going to share some of the free resources that I use to find answers when I run into a question using Julia. This is not meant to be an exhaustive list. Just a small sample of some of the resources available to you. If you have a question about Julia, the first place to check is the official Julia documentation. This is a great resource, but it's a technical document, so it's not meant to be read from beginning to end. But it has an excellent search feature, which I use frequently. The documentation often contains helpful code snippets that you can use to try out on your own. You can also find documentation when using the Julia REPL. The REPL comes included with "Help Mode", which you can enter by using the Question Mark character. The prompt will change, indicating that you are in Help Mode. Help Mode will return any documentation that it can find on your query. There are also help tools available in VS Code. For this example, I'm using the code from the chapter on External Packages. In VS Code, the Julia extension will provide you with a documentation if you hover over the code. You can scroll through the documentation by hovering over it and using the scroll wheel on your mouse. We haven't discussed this Julia panel yet, but if you click on the Julia logo icon along the left-hand side of VS Code, you'll see several different Julia panels. One of those panels is a documentation panel, which you can use to search for more information. You can increase the size of this window by hiding the other panels and by moving this vertical bar. Another interesting tool is the Workspace panel. The Workspace panel shows all of the modules, functions and variables that are active in the current session. In this project, there are two variables named "xs" and "ys", which contain 1000 floating point numbers each. 1000 numbers is too much to display in the REPL, but sometimes you need to see all of the elements. One way that you can do this is by clicking on the View Table icon that will appear if you hover to the right of the variable name. A Julia Table tab will appear showing all 1000 elements in that vector. You can sort this table by clicking on the column header. Clicking once will sort from low to high. Clicking again will sort from high to low. And clicking a third time will return the vector back to its original order. These are all non-destructive sorts, so you don't need to worry about messing up your data. So those are some of the helpful tools available to you in VS Code. Pluto also contains a helpful tool. For this section, I'm using the notebook from the chapter on Pluto. In Pluto, there's something called "Live Docs". Clicking on this button in the lower right corner of the notebook will launch the Live Docs window. As you type in a cell, the Live Docs window will update in real time. "Ooh!" If you can't find the documentation that you need, the best place to ask questions is on the Julia Discourse Forum. This resource will let you tap into the collective knowledge of the Julia community. You can also use my GitHub repository to find all of the code that I used in these videos. Finally, one of my favorite websites to learn how to write code in any language is the Rosetta Code website. This website contains a collection of many common programming tasks, along with a code for it written in many different languages. For example, a classic teaching example is something called "FizzBuzz". Read the description and then try to write the Julia code for it on your own. Believe it or not, you know everything that you need to know in order to solve this problem. But as a beginner, there's a good chance that you'll immediately forget everything that you've learned when you try to apply your knowledge. If that happens to you, don't despair. That's totally normal. Developing the ability to apply your knowledge to solve problems will come with experience. And using this website is a great way to get that experience. If you do run into a mental block when trying to solve this problem, that's the perfect learning opportunity. You can find the solution by clicking on this menu button in the upper left corner, and scrolling down until you find Julia and clicking on the link. Here you'll find several different solutions to this problem. Try typing in one of these solutions using the programming environment of your choice, to see if you can get it to work on your computer. Don't copy and paste the code. In order to get experience, you need to practice by typing in the code manually. There are over 1,000 tasks available at the Rosetta Code website. So, practice, practice, practice. So those are some of the free resources available to you, as you make your way on your Julia journey. The next chapter is the final chapter, [sad music] where we'll take a look back to see how far you've come. [swoosh] This is the final chapter in this series. If you made it this far, congratulations! [kids cheering] At this point, you know the basics of how to use Julia. You know how to install Julia. You know the Julia code for "Hello, World!". You know how to use the Julia REPL. You know how to use Julia in VS Code, using the Julia extension. You know how to perform basic math in Julia. You know what Booleans are. You know how variables work. You know various data types, including various data collections. You know how Control Flow works. You know how Functions work. You know how to use Julia Standard Library, as well as how to use external packages. You know how to use Pluto Notebooks. You know how to update Julia versions. And you know where to find help. That's a lot to learn, so take some time to celebrate your achievements. [party horn] A lot of what you learned in this series is general programming concepts. So even if you ultimately decide that Julia isn't for you, you can still apply the knowledge that you acquired here to many different programming languages. If you decide that Julia is for you, then the world is full of possibilities. What you choose to do with Julia is ultimately up to you. For those of you interested in more tutorials, I have many more available on this channel, but there are also many other excellent resources available online for free. No matter where your journey takes you, I thank you for sharing a portion of your journey with me. And my wish for you is that you're able find whatever it is that you're looking for. I'd also like to thank all of my Channel Members whose generous support has made these videos possible. Thanks for watching! And good luck on your Julia journey!