candy-rs

Syntaxic sugar for Rust

[![Repository](https://img.shields.io/badge/repository-GitHub-brightgreen.svg)][Repository] [![Latest version](https://img.shields.io/crates/v/candy.svg)][crates.io] [![Documentation](https://docs.rs/candy/badge.svg)][Documentation] License

Example

```rust

[macro_use] extern crate candy;

use ::std::*;

type ErrorMsg = borrow::Cow<'static, str>;

fallible!{ fn main () -> () =>! ErrorMsg : let inputnumber: u64 = { let (mbargv0, mbargv1) = { let mut args = env::args(); (args.next(), args.next()) }; let progname = mbargv0.unwrap(); match mbargv1 .andthen(|argv1| argv1.parse().ok()) { Some(number) => number, _ => throw!(format!("Usage: {} ", progname)), } }; collatzconjecture(inputnumber); }

fn collatzconjecture (mut n: u64) { doloop!({ println!("n = {}", n); if n % 2 == 0 { n /= 2; } else { n = 3 * n + 1; }; } while n != 1); println!("Did reach 1."); } ```

Usage