<br><div><span class="gmail_quote">On 9/3/07, <b class="gmail_sendername">Vimal</b> &lt;<a href="mailto:j.vimal@gmail.com">j.vimal@gmail.com</a>&gt; 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>&nbsp;&nbsp;S<br>&nbsp;&nbsp;if F then<br>&nbsp;&nbsp;&nbsp;&nbsp; break<br>&nbsp;&nbsp;end<br>&nbsp;&nbsp;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.&nbsp; Just add a boolean flag:<br><br>done = False<br>while E and not(done) do...
<br><br>I&#39;ll let you work out the rest.&nbsp; Unless I am missing something here... are you not allowed to introduce extra variables? It&#39;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.&nbsp; goto (which is essentially what break is) is never necessary.
<br><br>-Brent<br></div></div>