R_Code-6.r (476B)
1 # Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 19 Mar 2026 2 # Repo: https://github.com/notamitgamer/bsc 3 # License: MIT 4 5 # Write a while loop with a number variable starting at 1. 6 # The loop should print the number and increment it by 1, 7 # but you must include an if statement with a break command to 8 # stop the loop's execution exactly when number == 6 9 10 number <- 1 11 while (TRUE) { 12 if(number == 6) { 13 break 14 } 15 print(number) 16 number = number + 1 17 }