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-9.r

R_Code-9.r (285B)


      1 # Define a function called power that takes two parameters, 
      2 # a and b. Give a a default value of 2. The function should print the result 
      3 # of a raised to the power of b (a^b). 
      4 
      5 power <- function (a = 2, b) {
      6     return (a^b)
      7 }
      8 a <- 2
      9 b <- 3
     10 print(power(a, b))
     11 print(power("b" = b))