Last active
December 12, 2015 10:39
-
-
Save JohnMurray/4760447 to your computer and use it in GitHub Desktop.
simple rust program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct MyStruct { | |
mut count : int | |
} | |
impl MyStruct { | |
fn inc(&mut self) -> () { (*self).count += 1; } | |
} | |
fn main() -> () { | |
let STAT : MyStruct = MyStruct { count: 1 }; | |
io::println(int::str(STAT.count)); | |
STAT.inc(); | |
io::println(int::str(STAT.count)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment