Julia Tutorial
Julia is an open-source programming language under the MIT license, free for everyone to use.
Julia is a high-performance, dynamic, high-level programming language aimed at scientific computing.
Julia was originally designed to meet the needs of high-performance numerical analysis and computational science; it achieves execution speed close to that of C through JIT (just-in-time) compilation.
Julia was first released in 2012 and supports various platforms: macOS, Windows, Linux, FreeBSD.
Julia Language Features
Julia combines the ease of use of dynamic languages with the performance of statically compiled languages; its main features are as follows:
- The core language is very small; the standard library (including basic operations such as integer arithmetic) is written in Julia itself.
- Calls on many other mature, high-performance foundational code, such as linear algebra, random number generation, fast Fourier transforms, and string processing.
- Rich type syntax for creating or describing objects.
- High performance close to statically compiled languages, including user-defined types and more.
- No need to "vectorize" code for performance: writing scalar loops directly also runs very fast.
- Designed for parallel and distributed computing.
- Lightweight coroutines (Task) with multithreading support.
- An elegant, extensible type conversion and promotion system.
- Supports Unicode, including but not limited to UTF-8; variable names can even use Greek letters.
- Can directly call C functions (no wrappers or special APIs needed).
- Has shell-like process management capabilities.
- Has Lisp-like macros and other metaprogramming tools.
- Can be used with Jupyter notebookand Pluto together.
Julia Language Uses
Julia is mainly used for numerical computing; typical application scenarios include data science and statistical analysis, machine learning and artificial intelligence, optimization and operations research, computational biology, financial modeling, and more.
This tutorial is based on the stable Julia versions 1.10 / 1.11; all examples can be run directly in the REPL.
Your First Julia Program
Next, let's write our first Julia program, hello.jl (the Julia file extension is .jl); the code is as follows:
hello.jl file
Your First Julia Program: Hello, World
println
(
"Hello World!"
)
println
(
"RUNOOB Julia!"
)
To execute Julia code, you can use the julia hello.jl command.
Executing the above code outputs:
$ julia hello.jl
Hello World!
RUNOOB Julia!
Related links
Julia official website:https://julialang.org/
Julia documentation:https://docs.julialang.org/