[Gambas-user] is endif optional?

Daniel Campos dcamposf at ...626...
Fri Sep 22 10:27:17 CEST 2006


If you use the:

IF [CHECK] THEN [COMMAND]

syntax, Gambas and all the rest of BASIC interpreters I know,
understand that there's only a command to perform after the condition,
end END IF is not needed. END IF is used only if you have to
concatenate some commands after a condition, or use the ELSE keyword.

Daniel


2006/9/22, Werner <wdahn at ...1000...>:
> For some reason unremembered the code snippet below was in some software
> I wrote a while ago and it all worked.
>
> ' Gambas module file
>
> PUBLIC SUB Main()
> DIM hConn AS NEW Connection
>
> 'fill this in to suit your situation
>   WITH hConn
>     .Type = "mysql"
>     .Host = "localhost"
>     .Login = ""
>     .Password = ""
>     .Name = "test"
>   END WITH
>
>   TRY hConn.Open
>   IF ERROR THEN PRINT "Can't open db. Reason: " & ERROR.Text
>
> 'I cut the real code out.
> 'ISTR that when the opening of the connection failed (ie wrong user) the
> error cropped up further down when using the connection.
> 'Nevertheless, the absence of ENDIF was never complained about.
>   PRINT "yabadoo"
>
>
> END
>
> Best Regards
> Werner Dahn
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list