Hi there
I'm running a loop however it does not exit the loop when the condition is met.
I'm looping through a list of items using a for loop and using Exit to exit the loop inside a case statement, it however runs and runs all the toasts.
Line 145 below.
I'm running a loop however it does not exit the loop when the condition is met.
I'm looping through a list of items using a for loop and using Exit to exit the loop inside a case statement, it however runs and runs all the toasts.
Line 145 below.
B4X:
// [120] Sub ProcessCode()
this.processcode = function () {
if (self == null) self = this;
var _scode;
var _splines;
var _linecnt;
var _linetot;
var _strline;
var _strprefix;
// [122] Dim scode As String = Page.GetText(sc.GetRC(2,1))
_scode = self._page.gettext(self._sc.getrc(2, 1));
// [123] scode = scode.trim
_scode = _scode.trim();
// [124] If scode = {135} Then
if (_scode == "") {
// [125] App.ToastError( {136} )
self._app.toasterror("You need to paste / write some scripts here...");
// [126] Page.SetFocusDiv(sc.GetRC(2,1))
self._page.setfocusdiv(self._sc.getrc(2, 1));
// [127] Return
return;
// [128] End If
}
// [130] Dim spLines As List = App.StrParse( {137} ,scode)
_splines = self._app.strparse(";", _scode);
// [132] Dim lineCnt As Int
_linecnt = 0;
// [133] Dim lineTot As Int = spLines.Size - 1
_linetot = _splines.length - 1;
// [134] For lineCnt = 0 To lineTot
for (_linecnt = 0; _linecnt <= _linetot; _linecnt++) {
// [135] Dim strLine As String = spLines.Get(lineCnt)
_strline = _splines[_linecnt];
// [136] Dim strPrefix As String = App.MvField(strLine,1, {138} )
_strprefix = self._app.mvfield(_strline, 1, ".");
// [137] Select Case strPrefix
switch ("" + _strprefix) {
// [138] Case {139}
case "" + "circle":
// [139] Case {140}
break;
case "" + "decision":
// [140] Case {141}
break;
case "" + "process":
// [141] Case {142}
break;
case "" + "oval":
// [142] Case {143}
break;
case "" + "rect":
// [143] Case Else
break;
default:
// [144] App.ToastError( {4} )
self._app.toasterror("There is an error around line " + _linecnt + " of the code flow, invalid prefix " + _strprefix + "");
// [145] Exit
break;
// [146] End Select
break;
}
// [147] Next
}
// End Sub
};