关注微信公共号:小程在线
关注CSDN博客:程志伟的博客
版本:1.4.2(2020-05-23)
一、基本命令与函数
1.print()和println()
print()函数只是输出结果,紧挨着前面的数据;
println()函数在输出结果之后,就会另起一行
julia> x=147;y=852;print(x," ",y)
147 852
julia> print(x,y);print("!")
147852!
julia> println(x);println(y);println(%)
147
852
rem
2.typemax和typemin
可以知道数据类型的最大值与最小值
julia> typemax(Int64)
9223372036854775807
julia> typemin(Int32)
-2147483648
julia> typemax(Float64)
Inf
3.collect函数
collect(ElementType,X),X是任意数据类型,对应着一定范围的数据(称为集合)
julia> collect(1:5)
5-element Array{Int64,1}:
1
2
3
4
5
4.show函数
show(X),X可以是任意数据类型,可以查看一个数组中的内容
julia> x = 123;y = 456;
julia> show([x y])
[123 456]
julia> a = collect(1:25);show(a)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
5.LinRange函数
LinRange():0表示数据的开始,5表示数据的结束,11表示一共有11个数,按照相等的数据间隔分来
LinRange(0,5,11)
11-element LinRange{Float64}:
0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0