This got me thinking.No. It is not a "real" method. It is a compiler feature.
I apologize in advance for my post as it is not the right place; but its ending part...I wish my national leaders would listen to the citizens voice before implementing a new law like what happened here. ?
I went back to the drawing board
I do not wonder at all if Erel used a UML editor.
No. Only paper and pen.
and correction fluid?
?Never needed one.
Because Erel uses second piece of paper. The first one already become crumpled ball. ?Never needed one.
Button1.As(JavaObject).RunMethod("setMouseTransparent", Array(True))
'equivalent to:
Dim jo As JavaObject = Button1
jo.RunMethod("setMouseTransparent", Array(True))
Log(Me.As(JavaObject).RunMethod("sum", Array((10).As(Float), (20).As(Double))))
'equivalent to:
Dim jme As JavaObject = Me
Dim f As Float = 10
Dim d As Double = 20
Log(jme.RunMethod("sum", Array(f, d)))
#if Java
public double sum(float n1, double n2) {
return n1 + n2;
}
#End If
Great examples. Very clear and easy to like! ?Another example
? ?So visually even constants can have "methods". Brilliant as always.
Dim result As Long
result=24*60*60*180*1000 ' Result was incorrect
Dim result As Long
result=24*60*60*180*(1000).As(Long)
! ?
(10).As(Double)
(10).As(Double)
A constant expression like 10 has a method called .As()
See, I have glasses for the brain. Glasses and glasses. Of beer.I would need glasses for the brain too, though.
?
In 1986 a program code "listing" appeared in a magazine about the Sinclair Spectrum computer. The program defined graphics for a ship and a helicopter and the program made you control the helicopter to land on the ship(which was rocking in the ocean). The helicopter blew up if you missed the landing.Soon we can write any app with B4X with only one line of code ?
Yes. Better to start with the Long type as the expression is evaluated from left to right:So using your example above, against a previous problem question posted in forum, we could now get the correct result.
Original problem
result=(24).As(Long)*60*60*180*1000
Testing nested IIf:Soon we can write any app with B4X with only one line of code
Private Sub Button1_Click
Label1.Text = IIf(IsNumber(TextField1.Text) = False, "Invalid number", IIf(TextField1.Text > number, "My number is smaller", IIf(TextField1.Text < number, "My number is larger", "Well done!!!")))
End Sub
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?