Recent

Author Topic: syntax of the if-then-else construct  (Read 4146 times)

SaintMichael57

  • New Member
  • *
  • Posts: 18
syntax of the if-then-else construct
« on: June 30, 2017, 12:23:37 pm »
Dear FreePascal Community:
     Could you please describe the syntax of the if-then-else construct
which has imbedded in it compound statements?  Thank you.


                                       Best regards,
                                       Carl Mesaros :)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12035
  • FPC developer.
Re: syntax of the if-then-else construct
« Reply #1 on: June 30, 2017, 12:27:47 pm »
If you go to the manual,

https://www.freepascal.org/docs-html/ref/ref.html

and search for "then" or "else", you'll find

https://www.freepascal.org/docs-html/ref/refsu57.html#x163-18500013.2.3

which has an example of nested if then else.

Handoko

  • Hero Member
  • *****
  • Posts: 5387
  • My goal: build my own game engine using Lazarus
Re: syntax of the if-then-else construct
« Reply #2 on: June 30, 2017, 12:28:57 pm »

J-G

  • Hero Member
  • *****
  • Posts: 959
Re: syntax of the if-then-else construct
« Reply #3 on: June 30, 2017, 02:08:58 pm »
Also this:
http://wiki.freepascal.org/Else
To make the nested IF statement clearer, there ought to be a change to the indentation, viz:

Code: Pascal  [Select][+][-]
  1.  
  2. if a then
  3.       if b then
  4.         begin
  5.            (..)
  6.         end;
  7. else
  8.   begin
  9.      (..)
  10.   end;
  11.  
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

Eugene Loza

  • Hero Member
  • *****
  • Posts: 729
    • My games in Pascal
Re: syntax of the if-then-else construct
« Reply #4 on: June 30, 2017, 02:39:37 pm »
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

guest60499

  • Guest
Re: syntax of the if-then-else construct
« Reply #5 on: June 30, 2017, 03:59:44 pm »
I tend to like this website despite the ads. I might start referring to the Castle engine's documentation now.

Most places miss the syntax difference between the statement and block versions.

Thaddy

  • Hero Member
  • *****
  • Posts: 16520
  • Kallstadt seems a good place to evict Trump to.
Re: syntax of the if-then-else construct
« Reply #6 on: June 30, 2017, 05:02:14 pm »
I have the slight suspicion( >:D) he is asking about a ternary operator function...... O:-) Compound statement?
But I am sure they don't want the Trumps back...

 

TinyPortal © 2005-2018