While-lussen

R voor finance voor gevorderden

Lore Dirick

Manager of Data Science Curriculum at Flatiron School

While-lus

i <- 0
while(i < 3) {
    print(i)
    i <- i + 1
}
0
1
2
R voor finance voor gevorderden

Controleer while true

stock_price <- 52.1
while(stock_price <= 52.5) {
  stock_price <- stock_price * runif(1, .99, 1.01)
  print(stock_price)
}

print("Aandeelkoers is boven 52.5! Verkopen!")
52.01159
52.46679
52.00211
52.48659
52.99241
"Aandeelkoers is boven 52.5! Verkopen!"
R voor finance voor gevorderden

Laten we oefenen!

R voor finance voor gevorderden

Preparing Video For Download...