Get startedGet started for free

Function scope (2)

Let's try another one. Here, hundred is defined outside of the function scope, but is used inside of the function.

hundred <- 100

percent_to_decimal <- function(percent) {
    percent / hundred
}

What will percent_to_decimal(6) return?

This exercise is part of the course

Intermediate R for Finance

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise