Created
June 17, 2018 01:14
-
-
Save Centril/baeba93ba0d5bf98d45d80e621bbdd46 to your computer and use it in GitHub Desktop.
for/while/while let .. else
This file contains 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
// while P { B_1 } else { B_2 } */ | |
// ==> | |
/* | |
if P { | |
B_1; | |
while P { | |
B_1 | |
} | |
} else { | |
B_2 | |
} | |
*/ | |
// while let PAT = E { B_1 } else { B_2 } */ | |
// ==> | |
/* | |
if let PAT = E { | |
B_1; | |
loop { | |
if let PAT = E { | |
B_1 | |
} else { | |
break; | |
} | |
} | |
} else { | |
B_2 | |
} | |
*/ | |
// for PAT in E { B_1 } else { B_2 } */ | |
// ==> | |
/* | |
{ | |
let mut iter = E.into_iter(); | |
while let Some(PAT) = iter.next() { | |
B_1 | |
} else { | |
B_2 | |
} | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment