[Gambas-user] Question about writing If-clauses

Rolf-Werner Eilert rwe-sse at osnanet.de
Thu Feb 1 08:29:44 CET 2018


This is from the code snippet Benoit posted yesterday:

If InStr(Me.STRING_DELIM, Key.Text) And If hEditor.Column < 
hEditor.Current.Length Then

Do you always repeat "If" after "And", "Or" etc.? And why?

I know it (and write it) like If ... And ... Then

There is another line where it might make more sense:

If Not InsideStringEscape And If String.Mid$(hEditor.Current.Text, 
hEditor.Column + 1, 1) = Key.Text Then

I have to admit, it looks clearer like this, because it says "If Not ... 
And If [Yes] ... Then". But still I am surprised, would it be wrong to 
write it like

If Not ... And ... Then

Thanks for your insight!

Rolf


More information about the User mailing list