Skip to content

Commit

Permalink
Improve example by only keeping minimal syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Apr 18, 2024
1 parent aedbfa6 commit 6f23c31
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions examples/for_while.con
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
mod Example {
fn main() -> i64 {
return sum_to(4);
return sum_to_twice(4);
}

fn sum_to(limit: i64) -> i64 {
fn sum_to_twice(limit: i64) -> i64 {
let mut result: i64 = 0;

let n: i64 = 1;
for (; n <= limit ;) {
result = result + n;
n = n + 1;
}

n = 1;
for (n <= limit) {
result = result + n;
n = n + 1;
Expand Down

0 comments on commit 6f23c31

Please sign in to comment.