Old lady swallowed a fly: Difference between revisions

Content added Content deleted
m (→‎{{header|Rust}}: Spacing.)
m (→‎{{header|Rust}}: Updated playground link.)
Line 2,057: Line 2,057:
end</lang>
end</lang>
=={{header|Rust}}==
=={{header|Rust}}==
[https://play.rust-lang.org/?gist=294c9e29f206d7c8d8028aa5e7002d9a&version=nightly Rust Playground]
[https://play.rust-lang.org/?code=enum%20Action%20%7B%0A%20%20%20%20Once%2C%0A%20%20%20%20Every%2C%0A%20%20%20%20Die%2C%0A%7D%0Ause%20Action%3A%3A*%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20animals%20%3D%20%5B(%22horse%22%2C%20Die%2C%20%22She%27s%20dead%2C%20of%20course!%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%22donkey%22%2C%20Once%2C%20%22It%20was%20rather%20wonky.%20To%20swallow%20a%20donkey.%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%22cow%22%2C%20Once%2C%20%22I%20don%27t%20know%20how.%20To%20swallow%20a%20cow.%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%22goat%22%2C%20Once%2C%20%22She%20just%20opened%20her%20throat.%20To%20swallow%20a%20goat.%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%22pig%22%2C%20Once%2C%20%22Her%20mouth%20was%20so%20big.%20To%20swallow%20a%20pig.%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%22dog%22%2C%20Once%2C%20%22What%20a%20hog.%20To%20swallow%20a%20dog.%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%22cat%22%2C%20Once%2C%20%22Fancy%20that.%20To%20swallow%20a%20cat.%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%22bird%22%2C%20Once%2C%20%22Quite%20absurd.%20To%20swallow%20a%20bird.%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%22spider%22%2C%20Once%2C%20%22That%20wriggled%20and%20jiggled%20and%20tickled%20inside%20her.%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%22fly%22%2C%20Every%2C%20%22I%20don%27t%20know%20why%20she%20swallowed%20the%20fly.%22)%5D%3B%0A%20%20%20%20for%20(i%2C%20a)%20in%20animals.iter().enumerate().rev()%20%7B%0A%20%20%20%20%20%20%20%20println!(%22There%20was%20an%20old%20lady%20who%20swallowed%20a%20%7B%7D%5Cn%7B%7D%22%2C%20a.0%2C%20a.2)%3B%0A%20%20%20%20%20%20%20%20if%20let%20Die%20%3D%20a.1%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20for%20(swallowed%2C%20to_catch)%20in%20animals%5Bi..%5D.iter().zip(%26animals%5Bi%20%2B%201..%5D)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20println!(%22She%20swallowed%20the%20%7B%7D%20to%20catch%20the%20%7B%7D.%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20swallowed.0%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20to_catch.0)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20let%20Every%20%3D%20to_catch.1%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20println!(%22%7B%7D%22%2C%20to_catch.2)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20println!(%22Perhaps%20she%27ll%20die.%5Cn%22)%3B%0A%20%20%20%20%7D%0A%7D%0A&version=nightly&backtrace=0 Rust Playground]
<lang rust>enum Action {Once, Every, Die}
<lang rust>enum Action {Once, Every, Die}
use Action::*;
use Action::*;