julia函数定义与调用示例代码
代码语言:julia
所属分类:其他
代码描述:julia函数定义与调用示例代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
# function to calculate the volume of a sphere function sphere_vol(r) # julia allows Unicode names (in UTF-8 encoding) # so either "pi" or the symbol π can be used return 4/3*pi*r^3 end # functions can also be defined more succinctly quadratic(a, sqr_term, b) = (-b + sqr_term) / 2a # calculates x for 0 = a*x^2+b*x+c, arguments types can be defined in function def.........完整代码请登录后点击上方下载按钮下载查看
网友评论0