<br><div><span class="gmail_quote">On 9/3/07, <b class="gmail_sendername">Vimal</b> <<a href="mailto:j.vimal@gmail.com">j.vimal@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br>In my Paradigms of Programming course, my professor presents this piece of code:<br><br>while E do<br> S<br> if F then<br> break<br> end<br> T<br>end<br><br>He then asked us to *prove* that the above programming fragment cannot
<br>be implemented just using if and while statement, even if S and T can<br>be duplicated a finite number of times</blockquote><div><br><br>But it IS possible. Just add a boolean flag:<br><br>done = False<br>while E and not(done) do...
<br><br>I'll let you work out the rest. Unless I am missing something here... are you not allowed to introduce extra variables? It's a strange thing for your professor to ask, since under reasonable assumptions, anything that is computable can be done only using if and while. goto (which is essentially what break is) is never necessary.
<br><br>-Brent<br></div></div>