BASIC (Beginner's All-purpose Symbolic Instruction Code) has long been revered for its accessibility and ease of use, making it an ideal language for beginners to grasp fundamental concepts. In this blog post, we will explore a captivating BASIC program that unveils a visual journey by printing ascending substrings of a string. Here is the simple string manipulation pattern program which will draw the following output.
- CLS: clears the screen
- X$ = "COMPUTER": X$ string variable is declared and assigned the value "COMPUTER"
- FOR i = 1 TO LEN(X$)): Iterating from 1 to the length of the string X$
- PRINT LEFT$(X$, i): Within the loop, the LEFT$ function extracts a substring from the left side of the string X$, with the length determined by the loop variable i. Each iteration prints a progressively larger portion of the leftmost characters
- NEXT i: End of the loop
- END: End of the program
Program
Using SUB Procedure
Using FUNCTION Procedure