High-performance scientific computing and numerical analysis.
println("Hello, World!")
# Basic Types in Julia
string_var = "Rau ma" # String
int_var = 36 # Integer
float_var = 3.6 # Float
bool_var = true # Boolean
char_var = 'A' # Character
println(typeof(string_var)) # String
println(typeof(int_var)) # Int64
if 36 < 92
println("36 is less than 92")
elseif 36 == 92
println("36 equals 92")
else
println("36 is greater than 92")
end
# For loop
for i in 1:10
println("Number: $i")
end
# While loop
n = 3
while n > 0
println("Countdown: $n")
global n = n - 1
end
Julia calls different function implementations based on the types of the arguments.
function add(a::Int, b::Int)
println("Adding Integers")
a + b
end
function add(a::Float64, b::Float64)
println("Adding Floats")
a + b + 0.5
end
add(10, 20) # Calls Int version
add(10.0, 20.0) # Calls Float version
arr = [18, 36, 92]
push!(arr, 43)
println(sum(arr))
dict = Dict("name" => "Alice", "age" => 30)
println(dict["name"])
using Plots
x = 1:10
y = rand(10)
plot(x, y, title="Random Plot")
savefig("plot.png")