▲ 150 ▼ proportional reaction (lemmy.blahaj.zone) submitted 11 months ago by guber@lemmy.blahaj.zone to c/lemmyshitpost@lemmy.world 45 comments fedilink hide all child comments
[–] calcopiritus@lemmy.world 3 points 11 months ago Because it can be done for multiple lines too. And you can do else-if too. Also, "if" and "else" is more recognizable than "?" and ":" x = if y > 5 { println!("Y was over 5"); z + 5 } else if y < 0 { handle_negative_y(y); z - y } else { println!("<WARN> unexpected value for y"} 0 } permalink fedilink source parent