Discussions related to Visual Prolog
Peter Muraya
VIP Member
Posts: 147 Joined: 5 Dec 2012 7:29
Post
by Peter Muraya » 22 Sep 2015 9:08
Thomas,
I'm thinking about this code that does nothing on
then :-
Code: Select all
if condition( ) then else do_something( ) end if
Suppose you do away with
then , so that:-
Code: Select all
if condition( ) else do_something( ) end if
is recognized as a valid statement. What are your thoughts on this?
Mutall Data Management Technical Support
Thomas Linder Puls
VIP Member
Posts: 1410 Joined: 28 Feb 2000 0:01
Post
by Thomas Linder Puls » 22 Sep 2015 10:37
This has already been discussed internally and the conclusion was that too many people found it awkward.
But I can take it up again.
Regards Thomas Linder Puls
PDC
Paul Cerkez
VIP Member
Posts: 106 Joined: 6 Mar 2000 0:01
Post
by Paul Cerkez » 22 Sep 2015 11:05
I agree with the "awkward"
Stay consistent with the then as always part of the syntax.
AI Rules!
P.
Peter Muraya
VIP Member
Posts: 147 Joined: 5 Dec 2012 7:29
Post
by Peter Muraya » 22 Sep 2015 17:14
... and if both
then and
else are omitted, then the compiler ignores the
if/end if and executes the condition, so that:-
is equivalent to simply
Mutall Data Management Technical Support
Peter Muraya
VIP Member
Posts: 147 Joined: 5 Dec 2012 7:29
Post
by Peter Muraya » 23 Sep 2015 5:48
Thank you Harrison for the link.
VB has the notion of a multi-line syntax which Prolog does not (except for comments where % is for single line and /**/ is for mult-line) . So, the empty
if statement can is coded in 2 different ways in VB:-
Code: Select all
' Multiple-line syntax:
If condition
End If
and
Code: Select all
' Single-line syntax:
If condition Then
Note that (a) the single line syntax has no
end if and (b)
end if must appear on a different line from the
in the multi-line version.
Mutall Data Management Technical Support