jack
New Member
Posts: 9
|
Post by jack on Sept 5, 2015 1:34:21 GMT -6
I'm sorry, but I have a new problem. Apparently, it is a problem with a nested if.
If I run the following source with line "Check_Position(30, 60)" , it runs normally, and the window displays correctly the title "Case 1"
But if I run with the line "Check_Position(100, 100)", I have in the black window the mention : VM crashes on 24931. I do not understand why.
In this case, in the sub-program Check_Position, the condition "x>15 and x<58" of the main IF is false, and normally the execution leaves the sub-program. But it seems that End Sub is not executed. Or I do not understand how to use if condition statement. Is ELSE mandatory ? Please, can you explain me ?
Sub Check_Position(x, y) if x>15 and x<58 then
if y>39 and y<81 then SetWindowTitle("case 1") elseif y>87 and y<130 then SetWindowTitle("case 2") elseif y>135 and y<178 then SetWindowTitle("case 3") elseif y>185 and y<226 then SetWindowTitle("case 4") End If
End If End Sub
WindowOpen ( 0,"my window", 198, 114, 285, 270,0) Window ( 0) ScreenOpen ( 0, 285, 270, 0, 0, 285,270, 0) Screen ( 0)
While Inkey()<>27 Update() Wait(10) ' Check_Position(30, 60) Check_Position(100, 100) Wend
|
|
|
Post by n00b on Sept 5, 2015 5:47:28 GMT -6
Your code is right. The bug is in the runtime. I will fix it and post another update today.
|
|
|
Post by n00b on Sept 5, 2015 7:24:36 GMT -6
I have uploaded a new minor release that fixes the problem with IF statements and improves stabilitiy in the editor. RC Basic v1.2.2
|
|