We did see namespaces a bit, in ownership with String::from

This commit is contained in:
Carol (Nichols || Goulding) 2016-07-21 21:50:45 -04:00
parent 507a668cb0
commit c56d76de65

View File

@ -74,12 +74,13 @@ f64::powi(2.0, 3)
``` ```
The double colon (`::`) here is a namespace operator. We havent talked about The double colon (`::`) here is a namespace operator. We havent talked about
modules yet, but you can think of the `powi()` function as being scoped inside modules and namespaces in depth yet, but you can think of the `powi()` function
of another name. In this case, the name is `f64`, the same as the type. The as being scoped inside of another name. In this case, the name is `f64`, the
`powi()` function takes two arguments: the first is a number, and the second is same as the type. The `powi()` function takes two arguments: the first is a
the power that it raises that number to. In this case, the second number is an number, and the second is the power that it raises that number to. In this
integer, hence the i in its name. Similarly, `sqrt()` is a function under the case, the second number is an integer, hence the i in its name. Similarly,
`f64` module, which takes the square root of its argument. `sqrt()` is a function under the `f64` module, which takes the square root of
its argument.
## Why `struct`s? ## Why `struct`s?