<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — DO LOOP not executing?]]></title>
	<link rel="self" href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=881&amp;type=atom" />
	<updated>2023-01-13T17:39:31Z</updated>
	<generator>PunBB</generator>
	<id>http://forums.approximatrix.com/viewtopic.php?id=881</id>
		<entry>
			<title type="html"><![CDATA[Re: DO LOOP not executing?]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4038#p4038" />
			<content type="html"><![CDATA[<p>For the fun of it, you could investigate do i = -0, -1</p><p>Zero is a funny critter. It can get you into trouble in programming and roulette.</p>]]></content>
			<author>
				<name><![CDATA[designer]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3903</uri>
			</author>
			<updated>2023-01-13T17:39:31Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4038#p4038</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: DO LOOP not executing?]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4036#p4036" />
			<content type="html"><![CDATA[<p>You should think of the second number in the do loop as the inclusive point that will be the final loop step.&nbsp; The problem with</p><div class="codebox"><pre><code>do i = 0, -1</code></pre></div><p>is that the variable <em>i</em> already falls outside the inclusive stopping point of <em>-1</em>, so the loop never executes.&nbsp; In contrast, the line</p><div class="codebox"><pre><code>do i = 0, 0</code></pre></div><p>starts with a value of <em>i</em> that <em>does</em> fall within the inclusive upper limit of <em>0</em>, and the inner code block executes.</p><p>I believe the Fortran 66 standard actually did guarantee that loops would execute at least once regardless of conditions, but that behavior is no longer the standard as of Fortran 77.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2023-01-10T21:19:25Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4036#p4036</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[DO LOOP not executing?]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=4035#p4035" />
			<content type="html"><![CDATA[<p>Getting back into Fortran after many years..................</p><p>The following DO LOOP does not show up as either an error or warning when editing the code:</p><br /><p>implicit none</p><p>integer:: i = 0</p><p>do i = 0, -1<br />&nbsp; write (*,*)&#039;hello!&#039;<br />end do</p><p>the program compiles just fine, and when you launch it, it runs but you never see &quot;hello!&quot;.</p><p>My somewhat spotty memory is that one can do negative increments on DO loops, but the proper syntax would be something like</p><p>do i = 0, -10, -1</p><p>My first thought is perhaps the do loop is not executing because</p><p>do i = 0, -1, 1 is the same as do i = 0,0</p><p>however, using do i = 0,0 does execute the loop, and you see &quot;hello!&quot;.</p><p>Now with that said, I am saving the program with .for extension, which I assume triggers the F66 &amp; F77 compiler standards, but still seems weird.</p><p>Thoughts?</p>]]></content>
			<author>
				<name><![CDATA[Lewist57]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=4033</uri>
			</author>
			<updated>2023-01-10T00:44:39Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=4035#p4035</id>
		</entry>
</feed>
