Flux in Julia/Learning Julia (Intro_to_Julia)
01. Getting started
딥스탯
2018. 9. 11. 21:02
Getting started¶
Reference¶
https://github.com/JuliaComputing/JuliaBoxTutorials/tree/master/intro-to-julia (github : JuliaComputing/JuliaBoxTutorials/intro-to-julia)
Topics:
Series¶
http://deepstat.tistory.com/46 (01. Getting started(한글))
How to print ¶
Using println() to print
In [1]:
println("Hello, Julia!")
How to assign variables ¶
In [2]:
a = 1
println(a)
In [3]:
typeof(a)
Out[3]:
In [4]:
b = 1.1
println(b)
typeof(b)
Out[4]:
In [5]:
😺 = "smiley cat!"
println(😺)
typeof(😺)
Out[5]:
To type a smiley cat, use tab completion to select the emoji name and then tab again
In [6]:
# \:smi + <tab> --> select with down arrow + <enter> ---> <tab> + <enter> to complete
After assigning a value to a variable, we can reassign a value of a different type to that variable without any issue.
In [7]:
😺 = 1
println(😺)
typeof(😺)
Out[7]:
This allows us to write code like
In [8]:
😄 = 0
😠 = -1
😄 - 😺 == 😠
Out[8]:
How to comment ¶
In [9]:
# We can leave comments on a single line using the pound/hash key
In [10]:
#=
For multi-line comments,
use the '#= =#' sequence.
=#
Syntax for basic math ¶
In [11]:
my_sum = 3 + 7
Out[11]:
In [12]:
my_difference = 10 - 3
Out[12]:
In [13]:
my_product = 20 * 5
Out[13]:
In [14]:
my_quotient = 100 / 10
Out[14]:
In [15]:
my_power = 10 ^ 2
Out[15]:
In [16]:
my_modulus = 101 % 2
Out[16]:
In [17]:
?convert
Out[17]:
1.2¶
Assign 365 to a variable named days. Convert days to a float.
In [18]:
days = 356
Out[18]:
In [19]:
days_copy = convert(Float64,days)
Out[19]:
In [20]:
println(days)
typeof(days)
Out[20]:
In [21]:
println(days_copy)
typeof(days_copy)
Out[21]:
In [22]:
convert(Int64, "1")
In [23]:
parse(Int64, "1")
Out[23]:
In [24]:
typeof(parse(Int64, "1"))
Out[24]:
In [25]:
?parse
Out[25]: