Wish Add a space after each comma and function word automatically.

D

Deleted member 103

Guest
I know you can write a code like this
B4X:
Public Sub DistanceInMeters(Lat1 As Double,Long1 As Double,Alt1 As Int,Lat2 As Double,Long2 As Double,Alt2 As Int) As Double
    Dim XYZ1(3) As Double=LocationToPoint(Lat1,Long1,Alt1)
    Dim XYZ2(3) As Double=LocationToPoint(Lat2,Long2,Alt2)
    Dim dx As Double=XYZ1(0)-XYZ2(0)
    Dim dy As Double=XYZ1(1)-XYZ2(1)
    Dim dz As Double=XYZ1(2)-XYZ2(2)
    Return Sqrt(dx*dx+dy*dy+dz*dz)/1000
End Sub

But with blank is much more readable.
B4X:
Public Sub DistanceInMeters(Lat1 As Double, Long1 As Double, Alt1 As Int, Lat2 As Double, Long2 As Double, Alt2 As Int) As Double
    Dim XYZ1(3) As Double = LocationToPoint(Lat1, Long1, Alt1)
    Dim XYZ2(3) As Double = LocationToPoint(Lat2, Long2, Alt2)
    Dim dx As Double = XYZ1(0) - XYZ2(0)
    Dim dy As Double = XYZ1(1) - XYZ2(1)
    Dim dz As Double = XYZ1(2) - XYZ2(2)
    Return Sqrt (dx*dx + dy*dy + dz*dz) / 1000
End Sub
 

LucaMs

Expert
Licensed User
Longtime User
Useful, but not while you're writing, after (reformatting on "line lostfocus" :)); because I'm so used to put a space that otherwise I would have it two :)

Return Sqrt (dx*dx + dy*dy + dz*dz) / 1000
B4X:
Return Sqrt(dx * dx + dy * dy + dz * dz) / 1000
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
I agree and disagree. I like VS doing it's thing but also like the freedom to format certain thing's certain ways.
 
Top