---
title: "Julia下载&安装，和变量"
author: "myten"
date: "2018-08-21T10:55:41Z"
tags: []
categories: ["编程语言"]
slug: "julia"
draft: false
lastmod: "2018-08-22T09:45:15Z"
id: 2429026
url: "https://myten.iteye.com/blog/2429026"
---

url:https://julialang.org/downloads/

说明一下:

windows版本提供exe程序包，傻瓜式安装，安装完毕自然知道怎么使用。

苹果系统提供dmg程序包，也等同于傻瓜式安装。

但是，linux的同学辛苦些，需要自行下载tar包自行解压和配置环境变量。

另外，推荐下载1.0版本，但需要注意，学习资料的更新问题。

最后，肯定会有一个IDE的头等大事需要考虑。多方查阅资料，决定使用ATOM结合Juno插件。

 

```
println("Hello,Julia")
```

 

```
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.0 (2018-08-08)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> 
```

 将入门级的代码在控制台中输入后回车，就可看到

```
julia> println("Hello,Julia")
Hello,Julia
```

 到此为止，已经成功进入Julia的世界。我们接着来学习变量的定义，关于变量的值域，julia给出了一个表格。

整型：

Type Signed? Number of bits Smallest value Largest value [`Int8`](https://docs.julialang.org/en/stable/base/numbers/#Core.Int8) ✓ 8 -2^7 2^7 - 1 [`UInt8`](https://docs.julialang.org/en/stable/base/numbers/#Core.UInt8)   8 0 2^8 - 1 [`Int16`](https://docs.julialang.org/en/stable/base/numbers/#Core.Int16) ✓ 16 -2^15 2^15 - 1 [`UInt16`](https://docs.julialang.org/en/stable/base/numbers/#Core.UInt16)   16 0 2^16 - 1 [`Int32`](https://docs.julialang.org/en/stable/base/numbers/#Core.Int32) ✓ 32 -2^31 2^31 - 1 [`UInt32`](https://docs.julialang.org/en/stable/base/numbers/#Core.UInt32)   32 0 2^32 - 1 [`Int64`](https://docs.julialang.org/en/stable/base/numbers/#Core.Int64) ✓ 64 -2^63 2^63 - 1 [`UInt64`](https://docs.julialang.org/en/stable/base/numbers/#Core.UInt64)   64 0 2^64 - 1 [`Int128`](https://docs.julialang.org/en/stable/base/numbers/#Core.Int128) ✓ 128 -2^127 2^127 - 1 [`UInt128`](https://docs.julialang.org/en/stable/base/numbers/#Core.UInt128)   128 0 2^128 - 1 [`Bool`](https://docs.julialang.org/en/stable/base/numbers/#Core.Bool) N/A 8 `false` (0) `true` (1)

- 浮点型

Type Precision Number of bits [`Float16`](https://docs.julialang.org/en/stable/base/numbers/#Core.Float16) [half](https://en.wikipedia.org/wiki/Half-precision_floating-point_format) 16 [`Float32`](https://docs.julialang.org/en/stable/base/numbers/#Core.Float32) [single](https://en.wikipedia.org/wiki/Single_precision_floating-point_format) 32 [`Float64`](https://docs.julialang.org/en/stable/base/numbers/#Core.Float64) [double](https://en.wikipedia.org/wiki/Double_precision_floating-point_format) 64

看完后感慨，真是一个大胆的想法啊，没有了byte short double。取而代之的就是 vTypeXX格式，倒是把值域一下子说的很清楚啊。Int32就是2^32-1了。后边是啥就代表值域是啥，够犀利。

 

如此一来，变量的使用

```
nameStr="jack"
age=22
money=32.5
isEqual=false
```

 基本上就是四种模式了。

需要注意的是，全局变量的定义是不支持类型定义的，即age::Int8这种方式，但在结构体里允许。