Init from a func return value

This commit is contained in:
Dan Buch 2017-12-22 09:09:12 -05:00
parent 093698d6d2
commit 17566db003
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7

View File

@ -1,8 +1,9 @@
fn main() {
let y = {
let x = 3;
x + 1
};
println!("The value of y is: {}", y);
fn five() -> i32 {
5
}
fn main() {
let x = five();
println!("The value of x is: {}", x);
}