Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It does evaluate to something, try this if you don't believe me.

  fn try_option_some(param: Option<u8>) -> Option<u8> {
    if let Some(val) = param {
      Some(val + 1)
    } else {
      None
    }
  }

  fn main() {
    print!("{:?}\n", try_option_some(None));
    print!("{:?}\n", try_option_some(Some(2)));
  }


My bad, I think I read this as let val = if .... by accident. Oops




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: