Get startedGet started for free

Getting started with Julia

1. Getting started with Julia

Hi, and welcome to this introductory course on programming with Julia. I'm James, and I'll be leading you through this course.

2. What is Julia?

Julia is an open-source programming language, and compared to other languages used in data science, it is much newer. Julia is a general-purpose programming language that can be used for almost anything we would like to program. However, Julia was designed to be the ideal language for scientific computing, machine learning, and data mining, so these areas are where it shines.

3. Why create Julia?

Julia was created by Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and Alan Edelman. It was made to be simple to learn but deep enough that you should never outgrow it. It was designed to incorporate the best features of other scientific programming languages. To be as good at general programming as Python, as good at statistics as R, and as good at linear algebra as MATLAB. All while being as fast as compiled languages like C.

4. This course

In this course, we will cover the basics of the Julia language and won't assume you know any other programming languages. We will cover all the syntax and concepts you need to know so you can get started working with data in Julia. If you are already familiar with a language like Python, MATLAB, or R, you will learn the basics you need to translate your programming knowledge into Julia.

5. Installing Julia

If you want to install Julia on your own computer, you can download it from this link. However, you do not need to have it installed for this course. You can run Julia online from a browser here.

6. Scripts vs. the console

There are two different ways to run Julia code. The first way is using the console. On the DataCamp platform, you will see the console under the output tab. Here you can type commands and immediately see the results.

7. Scripts vs. the console

Sometimes we don't want to see the results because they are too long. Then we can use a semicolon to hide them.

8. Scripts vs. the console

The other way to run Julia code is by writing scripts. You will see a script located in the script-dot-jl tab. A script is a sequence of Julia commands inside a file. You can add many commands to this file, and they will be executed in order from top to bottom. Using a script means you can keep all the commands saved and reuse them repeatedly instead of manually typing them into the console each time. In the exercises you will often be working on a script.

9. Simple calculations and printing

When we write our code into a script we will not see the output from each line like in the console. Instead we can choose which lines to print using the println function. We write println and inside the parentheses we place whatever we want the script to print. In this example we print the number two and the sum of one plus two.

10. Comments

Inside this script, there are two lines that begin with a hash symbol. These are called comments, and allow you to annotate and add notes to your code. Julia will ignore these lines.

11. Comments

If we don't use the hash symbols, it will cause an error as Julia tries to run these lines as code.

12. Multi-line comments

We can spread comments over multiple lines using the multi-line comment syntax. We start the comment with hash-equals, with no space between them, and end it with equals-hash, again without a space.

13. Multi-line comments

Everything between these symbols will be ignored by Julia.

14. Let's practice!

Now, let's get started coding in Julia.