Orta Düzey R
Filip Schouwenaars
DataCamp Instructor
if(condition) {
expr
}
x <- -3
if(x < 0) {
print("x negatif bir sayı")
}
"x negatif bir sayı"
if(condition) {
expr
}
x <- 5
if(x < 0) {
print("x negatif bir sayı")
}
if(condition) {
expr1
} else {
expr2
}
x <- -3
if(x < 0) {
print("x negatif bir sayı")
} else {
print("x pozitif veya sıfır")
}
"x negatif bir sayı"
if(condition) {
expr1
} else {
expr2
}
x <- 5
if(x < 0) {
print("x negatif bir sayı")
} else {
print("x pozitif veya sıfır")
}
"x pozitif veya sıfır"
if(condition1) {
expr1
} else if(condition2) {
expr2
} else {
expr3
}
x <- -3
if(x < 0) {
print("x negatif bir sayı")
} else if(x == 0) {
print("x sıfır")
} else {
print("x pozitif bir sayı")
}
"x negatif bir sayı"
x <- 0
if(x < 0) {
print("x negatif bir sayı")
} else if(x == 0) {
print("x sıfır")
} else {
print("x pozitif bir sayı")
}
"x sıfır"
x <- 5
if(x < 0) {
print("x negatif bir sayı")
} else if(x == 0) {
print("x sıfır")
} else {
print("x pozitif bir sayı")
}
"x pozitif bir sayı"
x <- 6
if(x %% 2 == 0) {
print("2'ye tam bölünür")
} else if(x %% 3 == 0) {
print("3'e tam bölünür")
} else {
print("ne 2'ye ne 3'e bölünür...")
}
"2'ye tam bölünür"
Orta Düzey R