55 lines
996 B
Markdown
55 lines
996 B
Markdown
![]() |
## What's does `os.Args` variable store in its first item?
|
||
|
* The first argument that is passed to the program
|
||
|
* The second argument that is passed to the program
|
||
|
* Path to the running program *CORRECT*
|
||
|
|
||
|
## What's the type of the `Args` variable?
|
||
|
```go
|
||
|
var Args []string
|
||
|
```
|
||
|
* string
|
||
|
* string array
|
||
|
* a slice of strings *CORRECT*
|
||
|
|
||
|
## What is the type of each value in the `Args` variable?
|
||
|
```go
|
||
|
var Args []string
|
||
|
```
|
||
|
* string *CORRECT*
|
||
|
* string array
|
||
|
* a slice of strings
|
||
|
|
||
|
## How to get the first item of the `Args` variable?
|
||
|
```go
|
||
|
var Args []string
|
||
|
```
|
||
|
* Args.0
|
||
|
* Args{1}
|
||
|
* Args[0] *CORRECT*
|
||
|
* Args(1)
|
||
|
|
||
|
## How to get the second item of the `Args` variable?
|
||
|
```go
|
||
|
var Args []string
|
||
|
```
|
||
|
* Args.2
|
||
|
* Args[1] *CORRECT*
|
||
|
* Args{1}
|
||
|
* Args(2)
|
||
|
|
||
|
## How to get the length of the `Args` variable?
|
||
|
```go
|
||
|
var Args []string
|
||
|
```
|
||
|
* length(Args)
|
||
|
* Args.len
|
||
|
* len(Args) *CORRECT*
|
||
|
* Args.Length
|
||
|
|
||
|
## How to get the first "argument" from the command-line?
|
||
|
* os.Args[0]
|
||
|
* os.Args[1] *CORRECT*
|
||
|
* os.Args[2]
|
||
|
* os.Args[3]
|
||
|
|