PLayBASIC-Drawing-Triangle-And-Star-Shapes-With-Print-Statements

Started by kevin, February 04, 2023, 07:06:28 AM

Previous topic - Next topic

kevin


PLayBASIC-Drawing-Triangle-And-Star-Shapes-With-Print-Statements

  This example creates the simple triangle and star shapes using print statements



PlayBASIC Code: [Select]
   Pattern1()
Pattern2()
Pattern3()
Pattern4()


Sync
waitkey
waitnokey




Function Pattern1()
For lp=1 to 5
Print Make$("*",lp)
next
print ""
EndFunction


Function Pattern2()
For lp=1 to 5
Print Make$(" ",5-lp)+Make$("*",lp)
next
print ""
EndFunction



Function Pattern3()
For lp=1 to 5
Print Make$(" ",5-lp)+Make$("*",lp*2)
next
For lp=5 to 1 step -1
Print Make$(" ",5-lp)+Make$("*",lp*2)
next
print ""
EndFunction


Function Pattern4()
For lp=1 to 5
s$= Make$("*",lp)+make$(" ",5-lp)
Print s$+flip$(s$)
next
For lp=5 to 1 step -1
s$= Make$("*",lp)+make$(" ",5-lp)
Print s$+flip$(s$)
next
print ""
EndFunction