MulaiMulai sekarang secara gratis

Function scope (1)

Scoping is the process of how R looks a variable's value when given a name. For example, given x <- 5, scoping is how R knows where to look to find that the value of x is 5.

Try this scoping exercise!

percent_to_decimal <- function(percent) {
    decimal <- percent / 100
    decimal
}

percent_to_decimal(6)
[1] 0.06

What does typing decimal now return?

Latihan ini adalah bagian dari kursus

Intermediate R for Finance

Lihat Kursus

Latihan interaktif praktis

Ubah teori menjadi tindakan dengan salah satu latihan interaktif kami.

Mulai berolahraga