Please explain this weirdo

Questions and answers about BasicMaker 2018 for Windows
Post Reply
enonod
Posts: 28
Joined: Tue Nov 08, 2016 1:54 pm

Please explain this weirdo

Post by enonod » Sat Nov 30, 2019 12:40 pm

Stepping through the following code below in the Editor...
It works perfectly, failing each 'If' condition correctly... UNTIL you remove the 'Rem' on 'Do While' and 'Loop'. Then the final 'ElseIf' passes when it should fail, but note that both sets of code are identical.
I have simplified my code so as to eliminate anything to do with the spreadsheet that might have confused, or suggest it is the spreadsheet causing the problem.
This appears to be some kind of bug but I cannot get around it. Any ideas?

Code: Select all

Sub Update()

	Dim count As Integer, a As Integer, b As Integer
   	count = 3 :	a=4 : b=0

Rem	Do While count > 0
		count = count -1
'----------------------------------------------
		If a = 6 Then
			b=6
			a=3
		ElseIf a = 6 Then
			a=4
		End If
'-----------------------------------------------
		If a = 6 Then
			b=6
			a=3
		ElseIf a = 6 Then
			a=4
		End If
'-----------------------------------------------
Rem	Loop
End Sub

CWM
Posts: 1
Joined: Mon Jan 20, 2020 1:37 am

Re: Please explain this weirdo

Post by CWM » Mon Jan 20, 2020 1:43 am

Your code works fine (with or without the loop) the oddity looks like it is in the way BM steps through the lines. Even though it shows as if it is on the last line of the ElseIf statement, it does not execute it.

enonod
Posts: 28
Joined: Tue Nov 08, 2016 1:54 pm

Re: Please explain this weirdo

Post by enonod » Tue Feb 18, 2020 4:00 pm

Thank you CWM and sorry for the delay, I have been indisposed.

Post Reply

Return to “BasicMaker 2018 for Windows”