MulaiMulai sekarang secara gratis

Using message in practice

We're going to keep using the simulate() function, which performs a Monte-Carlo simulation. Often these simulations are time consuming, so it is helpful to give a progress report to the user. For example:

Simulation 1 complete
Simulation 2 complete

Latihan ini adalah bagian dari kursus

Defensive R Programming

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

N <- 10
results <- numeric(N)
for(i in 1:N) {
  results[i] <- simulate()
  # Show a progress report
  ___("___", ___, " complete")
}
Edit dan Jalankan Kode