Skip to content

Commit

Permalink
Release of Rust-0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
eliovir committed Apr 3, 2014
1 parent a226d85 commit b5f6916
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before_install:
- yes | sudo add-apt-repository ppa:hansjorg/rust
- sudo apt-get update
install:
- sudo apt-get install rust-nightly
- sudo apt-get install rust-0.10
- rustc --version
script:
- make clean test
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ rust-examples [![Ohloh statistics](http://www.ohloh.net/p/rust-examples/widgets/
gather example codes from tutorial and other documentations of
[Rust](http://www.rust-lang.org/) into files, ready to compile.

Examples are tested with version 0.10-pre.
Examples are tested with version 0.10.

## Files

* [Homepage](http://www.rust-lang.org/)
* `what_it_looks_like.rs`
* `what_it_looks_like.rs`, `what_it_looks_like2.rs`
* [Tutorial]
* [2.1](http://static.rust-lang.org/doc/master/tutorial.html#compiling-your-first-program) Compiling your first program: `tutorial-02_1-hello.rs`
* [3](http://static.rust-lang.org/doc/master/tutorial.html#syntax-basics) Syntax basics: `tutorial-03-syntax_basics.rs`
Expand Down
2 changes: 1 addition & 1 deletion tutorial-04_2-pattern-matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn angle(vector: (f64, f64)) -> f64 {
match vector {
(0.0, y) if y < 0.0 => 1.5 * pi,
(0.0, _) => 0.5 * pi,
(x, y) => atan(y / x)
(x, y) => (y / x).atan()
}
}
fn main() {
Expand Down
24 changes: 24 additions & 0 deletions what_it_looks_like2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//! Example given on the homepage (2014-04-03) http://www.rust-lang.org/
//!
//! @license MIT license <http://www.opensource.org/licenses/mit-license.php>
fn main() {
// A simple integer calculator:
// `+` or `-` means add/sub by 1
// `*` or `/` means mul/div by 2

let program = "+ + * - /";
let mut accumulator = 0;

for token in program.chars() {
match token {
'+' => accumulator += 1,
'-' => accumulator -= 1,
'*' => accumulator *= 2,
'/' => accumulator /= 2,
_ => { /* ignore everything else */ }
}
}

println!("The program \"{}\" calculates the value {}",
program, accumulator);
}

0 comments on commit b5f6916

Please sign in to comment.