D drfjm Member Licensed User Longtime User Nov 26, 2012 #1 Hello, I notice that If Not renonceTF Then is flagged as erroneous renonceTF has been declared as boolean, of course. However, when I write If Not (renonceTF) Then the expression is accepted. a bit weird Last edited: Nov 26, 2012
Hello, I notice that If Not renonceTF Then is flagged as erroneous renonceTF has been declared as boolean, of course. However, when I write If Not (renonceTF) Then the expression is accepted. a bit weird
agraham Expert Licensed User Longtime User Nov 26, 2012 #4 It is needed in Basic4andoid. Not() is a function not an operator.
J Jost aus Soest Active Member Licensed User Longtime User Nov 26, 2012 #5 agraham said: It is needed in Basic4andoid. Not() is a function not an operator. Click to expand... Yes, that's really a pity! IMHO B4A generally needs to much brackets, e. g. for calling void methods.
agraham said: It is needed in Basic4andoid. Not() is a function not an operator. Click to expand... Yes, that's really a pity! IMHO B4A generally needs to much brackets, e. g. for calling void methods.
Erel B4X founder Staff member Licensed User Longtime User Nov 26, 2012 #6 for calling void methods Click to expand... Brackets are not needed in this case.
J Jost aus Soest Active Member Licensed User Longtime User Nov 26, 2012 #7 Erel said: Brackets are not needed in this case. Click to expand... When I write something like Code: Copy Sub MyLog(s As String)'As Void Log(DateTime.Now & ": " & s) End Sub Sub Caller MyLog "OK" '<--no brackets End Sub I get an syntax error!?! (In VB it's valid syntax.) 'Cause I don't like to much brackets I've ever prefered VB to C++ or C!
Erel said: Brackets are not needed in this case. Click to expand... When I write something like Code: Copy Sub MyLog(s As String)'As Void Log(DateTime.Now & ": " & s) End Sub Sub Caller MyLog "OK" '<--no brackets End Sub I get an syntax error!?! (In VB it's valid syntax.) 'Cause I don't like to much brackets I've ever prefered VB to C++ or C!
Erel B4X founder Staff member Licensed User Longtime User Nov 27, 2012 #8 You are correct. I thought you were referring to methods without parameters.
R Roger Garstang Well-Known Member Licensed User Longtime User Nov 27, 2012 #9 Those Void return functions also often appear in the tooltips as being As String returns too. I think it is just how BASIC Subs/Functions differ from C++/JAVA Methods/Functions. In BASIC a Function without a return is a Sub and can be accessed like a statement (with/without parentheses). JAVA/C++ really doesn't have this and everything returns something...even if it is just VOID. B4A just uses the Sub keyword since it wouldn't be logical to split them like BASIC does when going to JAVA in the end. More code could be added in the parser I guess to allow for this and convert it, but then you'd also need to have both Function and Sub keywords to not be confusing.
Those Void return functions also often appear in the tooltips as being As String returns too. I think it is just how BASIC Subs/Functions differ from C++/JAVA Methods/Functions. In BASIC a Function without a return is a Sub and can be accessed like a statement (with/without parentheses). JAVA/C++ really doesn't have this and everything returns something...even if it is just VOID. B4A just uses the Sub keyword since it wouldn't be logical to split them like BASIC does when going to JAVA in the end. More code could be added in the parser I guess to allow for this and convert it, but then you'd also need to have both Function and Sub keywords to not be confusing.
J Jost aus Soest Active Member Licensed User Longtime User Nov 27, 2012 #10 Roger Garstang said: More code could be added in the parser I guess to allow for this and convert it, but then you'd also need to have both Function and Sub keywords to not be confusing. Click to expand... Personaly I could live very well with a Sub ... As Void to show the compiler, that I don't expect String (or smething else) as return type.
Roger Garstang said: More code could be added in the parser I guess to allow for this and convert it, but then you'd also need to have both Function and Sub keywords to not be confusing. Click to expand... Personaly I could live very well with a Sub ... As Void to show the compiler, that I don't expect String (or smething else) as return type.