Skip to content

Commit 783f8e7

Browse files
committed
Add what_it_looks_like3.rs
1 parent 4af7f48 commit 783f8e7

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Examples are tested with version 1.13.0.
1212
## Files
1313

1414
* [Homepage](http://www.rust-lang.org/)
15-
* `what_it_looks_like.rs`, `what_it_looks_like2.rs`
15+
* `what_it_looks_like.rs`, `what_it_looks_like2.rs`, `what_it_looks_like3.rs`
1616
* Old Tutorial, deprecated in favor of the [Book]
1717
* 2.1 Compiling your first program: `tutorial-02_1-hello.rs`
1818
* 3 Syntax basics: `tutorial-03-syntax_basics.rs`

what_it_looks_like3.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! Example given on the homepage (2017-08-12) http://www.rust-lang.org/
2+
//!
3+
//! @license MIT license <http://www.opensource.org/licenses/mit-license.php>
4+
fn main() {
5+
let greetings = ["Hello", "Hola", "Bonjour",
6+
"Ciao", "こんにちは", "안녕하세요",
7+
"Cześć", "Olá", "Здравствуйте",
8+
"Chào bạn", "您好"];
9+
10+
for (num, greeting) in greetings.iter().enumerate() {
11+
print!("{} : ", greeting);
12+
match num {
13+
0 => println!("This code is editable and runnable!"),
14+
1 => println!("¡Este código es editable y ejecutable!"),
15+
2 => println!("Ce code est modifiable et exécutable!"),
16+
3 => println!("Questo codice è modificabile ed eseguibile!"),
17+
4 => println!("このコードは編集して実行出来ます!"),
18+
5 => println!("여기에서 코드를 수정하고 실행할 수 있습니다!"),
19+
6 => println!("Ten kod można edytować oraz uruchomić!"),
20+
7 => println!("Esse código é editável e executável!"),
21+
8 => println!("Этот код можно отредактировать и запустить!"),
22+
9 => println!("Bạn có thể edit và run code trực tiếp!"),
23+
10 => println!("这段代码是可以编辑并且能够运行的!"),
24+
_ => {},
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)