Skip to content

Commit 795b3a8

Browse files
20250721 - if...else conditions
1 parent de1f255 commit 795b3a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dataManagement.Rmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ is.na(mydata$prediction) | mydata$parch >= 1
277277
# If...Else Conditions {#ifelse}
278278

279279
We can use the construction, `if()...else if()...else()` if we want to perform conditional operations.
280+
The typical construction of `if()...else if()...else()` operates such that it first checks if the first `if()` condition is true.
281+
If the first `if()` condition is true, it performs the operation specified and terminates the process.
282+
If the first `if()` condition is not true, it checks the `else if()` conditions in order until one of them is true.
283+
For the first true `else if()` condition, it performs the operation specified and terminates the process.
284+
If none of the `else if()` conditions is true, it performs the operation specified under `else()` and then terminates the process.
280285
The construction, `if()...else if()...else()` can only be used on one value at a time.
281286

282287
```{r}

0 commit comments

Comments
 (0)