Skip to content

Commit

Permalink
entry point -> test block
Browse files Browse the repository at this point in the history
  • Loading branch information
skylee03 committed Apr 2, 2024
1 parent 844f60a commit e784ca8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion course2/course_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
consume(num_bottles, 0)
}
// entry point
// test block
test {
// statements
@assertion.assert_eq(num_water_bottles(9, 3), 13)?
Expand Down
4 changes: 2 additions & 2 deletions course2/lecture_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int {
consume(num_bottles, 0)
}
// entry point
// test block
test {
// statements
@assertion.assert_eq(num_water_bottles(9, 3), 13)?
@assertion.assert_eq(num_water_bottles(15, 4), 19)?
}
```

In the above program, a top-level function and an entry point are defined. In the top-level function, a local function is defined and invoked. The value of the local function is a conditional expression. In the true branch, two variable bindings are defined, and the local function is called; whereas in the false branch, a simple addition operation is executed. In the entry point, two assertion commands are used to judge the correctness of our program.
In the above program, a top-level function and a test block are defined. In the top-level function, a local function is defined and invoked. The value of the local function is a conditional expression. In the true branch, two variable bindings are defined, and the local function is called; whereas in the false branch, a simple addition operation is executed. In the test block, two assertion commands are used to judge the correctness of our program.

Since this program does not generate any output, how exactly is it executed?

Expand Down

0 comments on commit e784ca8

Please sign in to comment.