Skip to content

Commit

Permalink
Example for literal expression, break, and continue statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Jun 30, 2024
1 parent 1a1d4c3 commit 3e6f731
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/example_21.utx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/local/bin/uartix
# Literal expression examples.

render 3.14 + "\r\n"; # Number
render true + "\r\n"; # True
render false + "\r\n"; # False
render nil; # Nil expression
10 changes: 10 additions & 0 deletions examples/example_22.utx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/local/bin/uartix
# Break loop if i is 5.

loop(i = 0; i < 10; i = i + 1) {
if(i == 5) {
break;
};

render i + "\r\n";
};
10 changes: 10 additions & 0 deletions examples/example_23.utx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/local/bin/uartix
# Skip loop iteration if i is even number.

loop(i = 0; i < 10; i = i + 1) {
if(i % 2 == 0) {
continue;
};

render i + "\r\n";
};

0 comments on commit 3e6f731

Please sign in to comment.