bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_1 / R / Code / R_Code-6.r

R_Code-6.r (350B)


      1 # Write a while loop with a number variable starting at 1. 
      2 # The loop should print the number and increment it by 1, 
      3 # but you must include an if statement with a break command to 
      4 # stop the loop's execution exactly when number == 6
      5 
      6 number <- 1
      7 while (TRUE) {
      8     if(number == 6) {
      9         break
     10     }
     11     print(number)
     12     number = number + 1
     13 }