In GW-BASIC FOR-NEXT is use for looping , you can print any number more than 1 time easily .
how to write FOR-NEXT
Some Examples
how to write FOR-NEXT
10 FOR A=1 TO 10Where A is a variable , 1 TO 10 this will PRINT SHAHZAIBBAIG 10 times, you can PRINT more than ten time, its is useful and short STATEMENT of GW-BASIC , NEXT Command is must if u donot write at the end the loop will not work and give you syntax error.
20 PRINT SHAHZAIBBAIG
30 NEXT A
Some Examples
10 FOR A = 3 TO 28 STEP 5Where STEP 5 will PRINT Like this 3 then 8 then 13 then 18 ....
20 PRINT A
30 NEXT A
You Can also do thisThis will minus 5 from 28 , when 3 comes program will stop
10 FOR A= 28 TO 3 STEP -5
20 PRINT A
30 NEXT A
3 comments:
it shows the error says: next without for
it wont,
it's most simplest program...
#mariayasir
https://www.youtube.com/watch?v=WSBu2t81Aec&list=PLO3e4ITl12R7_E_jTCc7Yax4jTtcBvdAj
Post a Comment