rust_extra/
do_while_loop.rs

1// This file is part of rust-extra. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/rust-extra/master/COPYRIGHT. No part of rust-extra, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2016 The developers of rust-extra. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/rust-extra/master/COPYRIGHT.
3
4
5#[macro_export]
6macro_rules! do_while_loop
7{
8    (
9        do
10        $body:block
11        while $cond:expr
12    ) =>
13    {
14        // A while statement can use {} instead of () if the condition is a block
15        while
16        {
17            $body;
18            $cond
19        }
20        {
21        }
22    };
23}