JakeBullet70 Well-Known Member Licensed User Longtime User Feb 13, 2014 #1 Hi all right now we do: B4X: Dim s as String = "Its a string" '--- love how we can do this Dim x As Int For x = 0 To 100 Next can we get B4X: For x as Int = 0 To 100 Next or is there a way to do this and I am missing it?
Hi all right now we do: B4X: Dim s as String = "Its a string" '--- love how we can do this Dim x As Int For x = 0 To 100 Next can we get B4X: For x as Int = 0 To 100 Next or is there a way to do this and I am missing it?
stevel05 Expert Licensed User Longtime User Feb 13, 2014 #2 You only need to do B4X: For x = 0 to 100 Next No need to dim it first. It will be done automatically.
You only need to do B4X: For x = 0 to 100 Next No need to dim it first. It will be done automatically.
JakeBullet70 Well-Known Member Licensed User Longtime User Feb 13, 2014 #3 This is true. I am just so use to Dim'ing everything. I wonder if there is a performance hit at all if you do not Dim it?
This is true. I am just so use to Dim'ing everything. I wonder if there is a performance hit at all if you do not Dim it?
Erel B4X founder Staff member Licensed User Longtime User Feb 13, 2014 #4 See For documentation: http://www.b4x.com/android/forum/pages/results/?query=for&page=1&prefix=0 The variable will be declared as an Int variable. There is no performance hit.
See For documentation: http://www.b4x.com/android/forum/pages/results/?query=for&page=1&prefix=0 The variable will be declared as an Int variable. There is no performance hit.
T tzfpg Active Member Licensed User Longtime User Feb 14, 2014 #5 how about using exit for? i add "exit for" return back error message. B4X: For k = 0 To Buffer.Length - 1 If int_hex>25 Then full_hex(int_hex)=msg Else int_hex=0 Exit For End If Next error message: Parsing code. Error Error parsing program. Error description: Missing Keyword: next Occurred on line: 88 End If
how about using exit for? i add "exit for" return back error message. B4X: For k = 0 To Buffer.Length - 1 If int_hex>25 Then full_hex(int_hex)=msg Else int_hex=0 Exit For End If Next error message: Parsing code. Error Error parsing program. Error description: Missing Keyword: next Occurred on line: 88 End If
klaus Expert Licensed User Longtime User Feb 14, 2014 #6 This code works: B4X: For k = 0 To Buffer.Length - 1 If int_hex > 25 Then full_hex(int_hex) = msg Else int_hex = 0 Exit End If Next
This code works: B4X: For k = 0 To Buffer.Length - 1 If int_hex > 25 Then full_hex(int_hex) = msg Else int_hex = 0 Exit End If Next