<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Needing help with nested conditions' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Needing help with nested conditions' posted on the 'Pascal' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 25 May 2013 06:37:47 -0700</pubDate>
    <lastBuildDate>Sat, 25 May 2013 06:37:47 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Needing help with nested conditions</title>
      <link>http://www.programmersheaven.com/mb/pasprog/393536/393536/needing-help-with-nested-conditions/</link>
      <description>Hi! I've recently started learing pascal, and i was trying here to do a program that asks for the user to enter 3 numbers, calculate the biggest and the least ( &amp;gt; and &amp;lt;   bad english) and print the results on the screen&lt;br /&gt;
this was my attempt:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;program mayorymenor;

var

num1 : integer;
num2 : integer;
num3 : integer;

begin

write ('introduzca el primer número');
readln (num1);
write ('introduzca el segundo número');
readln (num2);
write ('introduzca el tercer número');
readln (num3);

if num1 &amp;gt; num2 then
 if num1 &amp;gt; num3 then
 write ('el mayor es:', num1);
  if num2 &amp;gt; num3 then
  write ('el menor es:', num3);
  else
  write ('el menor es:', num2);
 else
 write ('el mayor es:', num3);
 write ('el menor es:', num2);
else
 if num2 &amp;gt; num3 then
 write ('el mayor es:', num2);
  if num3 &amp;gt; num1 then
  write ('el menor es:', num1);
  else
  write ('el menor es:', num3);
 else
 write ('el mayor es:', num3);
 write ('el menor es:', num1);

end.&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
But when i compile it :&lt;br /&gt;
&lt;br /&gt;
(23,3) Fatal syntax error, ";" expected but "ELSE" found.&lt;br /&gt;
&lt;br /&gt;
What is the problem? How do i solve it?&lt;br /&gt;
&lt;br /&gt;
Every "else"  and statement that corresponds to each If has the same indentation, and i think here is the problem&lt;br /&gt;
&lt;br /&gt;
gracias! &lt;br /&gt;
&lt;br /&gt;
PD: Introduzca el primer numero = enter the first number&lt;br /&gt;
      "         " segundo "     =   "    "    2º   "&lt;br /&gt;
      "         " tercer  "     =   "    "    3º   "&lt;br /&gt;
&lt;br /&gt;
    el menor es= the least is&lt;br /&gt;
    el mayor es= the biggest is&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/393536/393536/needing-help-with-nested-conditions/</guid>
      <pubDate>Fri, 10 Jul 2009 00:00:27 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Needing help with nested conditions</title>
      <link>http://www.programmersheaven.com/mb/pasprog/393536/393573/re-needing-help-with-nested-conditions/#393573</link>
      <description>&lt;strong&gt;else&lt;/strong&gt; cannot be preceded by a semicolon, but there's more wrong with your code than that.  Unless grouped together by &lt;strong&gt;begin/end&lt;/strong&gt;, an &lt;strong&gt;if&lt;/strong&gt; acts on only a single statement.  I have not studied your code in detail but I think this is what you want.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
program mayorymenor;

var
   num1  : integer;
   num2  : integer;
   num3  : integer;
   mayor : integer;
   menor : integer;

begin
   write ('introduzca el primer número');
   readln (num1);
   write ('introduzca el segundo número');
   readln (num2);
   write ('introduzca el tercer número');
   readln (num3);

   mayor := num1;
   if num2 &amp;gt; mayor then
      mayor := num2;
   if num3 &amp;gt; mayor then
      mayor := num3;
   write ('el mayor es: ', mayor) ;

   menor := num1;
   if num2 &amp;lt; menor then
      menor := num2;
   if num3 &amp;lt; menor then
      menor := num3;
   write ('el menor es: ', menor)
end.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/393536/393573/re-needing-help-with-nested-conditions/#393573</guid>
      <pubDate>Fri, 10 Jul 2009 23:59:25 -0700</pubDate>
      <category>Pascal</category>
    </item>
  </channel>
</rss>