
Small Basic: Printing Half Triangle Binary Pattern
Channel:
Subscribers:
613
Published on ● Video Link: https://www.youtube.com/watch?v=iOvp4E4vD-c
Hi, in this video we will print pattern like below:
1
0 1
1 0 1
0 1 0 1
Or, it is the same with:
a
b a
a b a
b a b a
This is the code:
For i = 0 To 20
If Math.Remainder(i,2) = 0 Then
Text2 = Text1
Text1 = "a " + Text2
TextWindow.WriteLine(Text1)
Else
Text2 = Text1
Text1 = "b " + Text2
TextWindow.WriteLine(Text1)
EndIf
endfor