New feature - inline casting

LucaMs

Expert
Licensed User
Longtime User
I wish my national leaders would listen to the citizens voice before implementing a new law like what happened here. πŸ˜…
I apologize in advance for my post as it is not the right place; but its ending part...

In Italy a relatively new party seemed to want to realize what you and I dream of; in addition, it streamed important meetings. In a short time it managed to get 33% of the votes in a national election. After that it disappointed everyone by not putting into practice what it proclaimed.

What is the ending that can be interesting? That I'd like to see Erel streaming while he...
I went back to the drawing board
:)

More generally I'd like to see how he works.
I think I've already written this in the past.
When I asked him what tools he used, for example to generate diagrams, he replied:
I do not wonder at all if Erel used a UML editor.
No. Only paper and pen.
and correction fluid? :D
Never needed one.
πŸ˜„
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Another example:
B4X:
Button1.As(JavaObject).RunMethod("setMouseTransparent", Array(True))
'equivalent to:
Dim jo As JavaObject = Button1
jo.RunMethod("setMouseTransparent", Array(True))

And a more complex one:
B4X:
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
 

Daestrum

Expert
Licensed User
Longtime User
So using your example above, against a previous problem question posted in forum, we could now get the correct result.

Original problem
B4X:
Dim result As Long
result=24*60*60*180*1000  ' Result was incorrect

Could be written as
B4X:
Dim result As Long
result=24*60*60*180*(1000).As(Long)
Which should result in the correct result.
 

Heuristx

Active Member
Licensed User
Longtime User
Soon we can write any app with B4X with only one line of code πŸ’ͺ
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.
The program consisted of 28 lines of Sinclair Basic code.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
So using your example above, against a previous problem question posted in forum, we could now get the correct result.

Original problem
Yes. Better to start with the Long type as the expression is evaluated from left to right:
B4X:
result=(24).As(Long)*60*60*180*1000
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Soon we can write any app with B4X with only one line of code
Testing nested IIf:
B4X:
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
Guess my number game.
 
Last edited:

udg

Expert
Licensed User
Longtime User
B4X:
Label1.Text = IIf(edLanguageUsed.Text = "B4X", "Good choice, B4xer", IIf(edLanguageUsed.Text = "", "Start B4X Programming!","Switch to B4X. Right Now!"))
πŸ˜€
 
Top