/src/test/run-pass/complex.rs

http://github.com/jruderman/rust · Rust · 33 lines · 23 code · 9 blank · 1 comment · 4 complexity · f36efcbbba43e515ab02b2a962005101 MD5 · raw file

  1. // -*- rust -*-
  2. type t = int;
  3. fn nothing() { }
  4. fn putstr(s: ~str) { }
  5. fn putint(i: int) {
  6. let mut i: int = 33;
  7. while i < 36 { putstr(~"hi"); i = i + 1; }
  8. }
  9. fn zerg(i: int) -> int { return i; }
  10. fn foo(x: int) -> int {
  11. let mut y: t = x + 2;
  12. putstr(~"hello");
  13. while y < 10 { putint(y); if y * 3 == 4 { y = y + 2; nothing(); } }
  14. let mut z: t;
  15. z = 0x55;
  16. foo(z);
  17. return 0;
  18. }
  19. fn main() {
  20. let x: int = 2 + 2;
  21. log(debug, x);
  22. debug!{"hello, world"};
  23. log(debug, 10);
  24. }