F fishwolf Well-Known Member Licensed User Longtime User Aug 14, 2020 #1 With ver 10 i have this warning Profile - 240: Comparison of Object to other types will fail if exact types do not match. Better to put the object on the right side of the comparison. (warning #35) on "IF" for this code Code: Copy Wait For ion_Event (MethodName As String, Args() As Object) If Args(0) = -1 Then How to fix it? Thanks
With ver 10 i have this warning Profile - 240: Comparison of Object to other types will fail if exact types do not match. Better to put the object on the right side of the comparison. (warning #35) on "IF" for this code Code: Copy Wait For ion_Event (MethodName As String, Args() As Object) If Args(0) = -1 Then How to fix it? Thanks
M Mahares Expert Licensed User Longtime User Aug 14, 2020 #2 fishwolf said: How to fix it? Click to expand... Try this, although I stand corrected:. Code: Copy Wait For ion_Event (MethodName As String, Args() As Object) dim a as int =Args(0) If a= -1 Then Upvote 0
fishwolf said: How to fix it? Click to expand... Try this, although I stand corrected:. Code: Copy Wait For ion_Event (MethodName As String, Args() As Object) dim a as int =Args(0) If a= -1 Then
aeric Expert Licensed User Longtime User Aug 14, 2020 #3 Change to: B4X: Copy If -1 = Args(0) Then Upvote 0
LucaMs Expert Licensed User Longtime User Aug 14, 2020 #4 fishwolf said: If Args(0) = -1 Then Click to expand... aeric said: Change to: B4X: Copy If -1 = Args(0) Then Click to expand... Upvote 0
fishwolf said: If Args(0) = -1 Then Click to expand... aeric said: Change to: B4X: Copy If -1 = Args(0) Then Click to expand...
F fishwolf Well-Known Member Licensed User Longtime User Aug 15, 2020 #5 LucaMs said: If -1 = Args(0) Then Click to expand... What is the reason? is it possible do a cast o conversion? Upvote 0
LucaMs said: If -1 = Args(0) Then Click to expand... What is the reason? is it possible do a cast o conversion?
aeric Expert Licensed User Longtime User Aug 15, 2020 #6 I think it is similar or equivalent to === in some language. It is a new feature to check the type of value with the object so the result of comparison is expected to be correct. I think it is easier to compare in this way instead of using === which may be more confusing. This feature is available since version 9.90 https://www.b4x.com/android/forum/threads/b4a-v9-90-has-been-released.119043/ Explanation: https://www.b4x.com/android/forum/t...-is-available-for-download.117877/post-737515 Last edited: Aug 15, 2020 Upvote 0
I think it is similar or equivalent to === in some language. It is a new feature to check the type of value with the object so the result of comparison is expected to be correct. I think it is easier to compare in this way instead of using === which may be more confusing. This feature is available since version 9.90 https://www.b4x.com/android/forum/threads/b4a-v9-90-has-been-released.119043/ Explanation: https://www.b4x.com/android/forum/t...-is-available-for-download.117877/post-737515