note01
◆ Variable declaration
integer
x = 1
y = -100
Real number
a = 2.0
b = 3.14
c = -5.0
◆ Declaration of constants
const t = 2020
◆ Character expression
x = 2
y = 2x + 1
h = sin(pi / 2)
In Julia, like JavaScript and Python, it is not necessary to specify the type of the variable (actually, it has the type internally). You can set the value intuitively.
The calculation result is also an integer.
The calculation result is a real number for both divisible and indivisible numbers.
The calculation result is a real number.
Constants are declared as const. If you change it later, an error will occur.
You can treat variables like mathematical expressions. You can also use mathematical arithmetic functions. The "$ \ pi $" and "e" used above are the following mathematical constants, respectively.
letter | Meaning and usage |
---|---|
Pi. On the keyboard\Enter "pi" and press the tab key. | |
e | Napier number(Natural logarithm).. On the keyboard\Enter "euler" and press the tab key. |
There are many other mathematical formulas. Please refer to the official document below for details.
:paperclip: Julia - Mathematics https://docs.julialang.org/en/v1/base/math/
In Julia, there are the following reserved words. You cannot use these as variable names on your own.
baremodule, begin, break, catch, const, continue, do, else, elseif, end, export, false, finally, for, function, global, if, import, let, local, macro, module, quote, return, struct, true, try, using, while
Please refer to the official document below for details.
:paperclip: Julia - Keywords https://docs.julialang.org/en/v1/base/base/#Keywords
Julia Quick Look Note [01] How to use variables and constants
(* We will continue to increase the content)
: paperclip: Julia --Official page https://julialang.org/
: paperclip: Julia --Japanese official document https://julia-doc-ja.readthedocs.io/ja/latest/index.html
: paperclip: First time Julia and installation (Windows & Linux) https://qiita.com/ttlabo/items/b05bb43d06239f968035
:paperclip: Julia - Mathematics https://docs.julialang.org/en/v1/base/math/
If you have any opinions or corrections, please let us know.
Recommended Posts