While döngüsü

Orta Düzey R

Filip Schouwenaars

DataCamp Instructor

while döngüsü

while(condition) {
  expr
}
while(ctr <= 7) {
Orta Düzey R

while döngüsü

while(condition) {
  expr
}
while(ctr <= 7) {
  print(paste("ctr is set to", ctr))
Orta Düzey R

while döngüsü

while(condition) {
  expr
}
while(ctr <= 7) {
  print(paste("ctr is set to", ctr))
  ctr <- ctr + 1
}
Orta Düzey R

while döngüsü

while(condition) {
  expr
}
while(ctr <= 7) {
  print(paste("ctr is set to", ctr))
  ctr <- ctr + 1
}
"ctr is set to 1"
Orta Düzey R

while döngüsü

while(condition) {
  expr
}
while(ctr <= 7) {
  print(paste("ctr is set to", ctr))
  ctr <- ctr + 1
}
"ctr is set to 2"
Orta Düzey R

while döngüsü

while(condition) {
  expr
}
while(ctr <= 7) {
  print(paste("ctr is set to", ctr))
  ctr <- ctr + 1
}
"ctr is set to 7"
Orta Düzey R

while döngüsü

while(condition) {
  expr
}
while(ctr <= 7) {
  print(paste("ctr is set to", ctr))
  ctr <- ctr + 1
}
  • Çıktı yok
Orta Düzey R

while döngüsü

ctr <- 1
while(ctr <= 7) {
  print(paste("ctr is set to", ctr))
  ctr <- ctr + 1
}
"ctr is set to 1"
"ctr is set to 2"
...
"ctr is set to 7"
ctr
8
Orta Düzey R

while döngüsü

ctr <- 1
while(ctr <= 7) {
  print(paste("ctr is set to", ctr))
  ctr <- ctr + 1
}
Orta Düzey R

Sonsuz while döngüsü

ctr <- 1
while(ctr <= 7) {
  print(paste("ctr is set to", ctr))

}
"ctr is set to 1"
"ctr is set to 1"
"ctr is set to 1"
"ctr is set to 1"
"ctr is set to 1"
"ctr is set to 1"
"ctr is set to 1"
...
Orta Düzey R

break deyimi

ctr <- 1
while(ctr <= 7) {
  if(ctr %% 5 == 0) {
    break
  }
  print(paste("ctr is set to", ctr))
  ctr <- ctr + 1
}
"ctr is set to 1"
"ctr is set to 2"
"ctr is set to 3"
"ctr is set to 4"
Orta Düzey R

Haydi pratik yapalım!

Orta Düzey R

Preparing Video For Download...