关注微信公共号:小程在线
关注CSDN博客:程志伟的博客
1.time()
这个时间是从1970年1月1日0时开始的,距今现在的时间
julia> time()
1.592537707458e9
2.条件语句
if-else语句
julia> x =5; y = 89;z=7;a=0;
julia> if x>=1
y += 30
else
a += 100
end;
julia> show([y,a])
[119, 0]
julia> if x ==5
z += 7
if y < 0
a +=100
else
a -= 100
end
end;
julia> show([z,a])
[14, -100]
julia> x =0; c =0;d=0;
julia> if x>0
c +=1
elseif x==0
d +=1
else
println("X IS NO")
end
1
julia> show([c,d])
[0, 1]
julia> x = 123;
julia> if x>0
"X is YES"
else
"X is NO"
end
"X is YES"
三元运算形式
julia> x =456;result = x>0 ? "X is Yes" : "X is No"
"X is Yes"
3.string()
string()可以将数字转化为字符串
julia> string(214)
"214"
string可以将多个变量转化为字符串拼接在一起
julia> string(214,true,"SNE",53.6)
"214trueSNE53.6"
4.map()
map(fun,arr):fun表示一个函数,arr表示一个数组
julia> show(map(length,["856","52","w","length"]))
5.version
julia> VERSION
v"1.4.2"