diff --git a/nac3standalone/demo/src/assignment.py b/nac3standalone/demo/src/assignment.py index c87ed03a6..3ae3a887c 100644 --- a/nac3standalone/demo/src/assignment.py +++ b/nac3standalone/demo/src/assignment.py @@ -9,6 +9,7 @@ def output_bool(x: bool): def example1(): x, *ys, z = (1, 2, 3, 4, 5) output_int32(x) + output_int32(len(ys)) output_int32(ys[0]) output_int32(ys[1]) output_int32(ys[2]) @@ -18,12 +19,14 @@ def example2(): x, y, *zs = (1, 2, 3, 4, 5) output_int32(x) output_int32(y) + output_int32(len(zs)) output_int32(zs[0]) output_int32(zs[1]) output_int32(zs[2]) def example3(): *xs, y, z = (1, 2, 3, 4, 5) + output_int32(len(xs)) output_int32(xs[0]) output_int32(xs[1]) output_int32(xs[2]) @@ -31,6 +34,12 @@ def example3(): output_int32(z) def example4(): + *xs, y, z = (4, 5) + output_int32(len(xs)) + output_int32(y) + output_int32(z) + +def example5(): # Example from: https://docs.python.org/3/reference/simple_stmts.html#assignment-statements x = [0, 1] i = 0 @@ -44,7 +53,7 @@ class A: def __init__(self): self.value = 1000 -def example5(): +def example6(): ws = [88, 7, 8] a = A() x, [y, *ys, a.value], ws[0], (ws[0],) = 1, (2, False, 4, 5), 99, (6,) @@ -63,4 +72,5 @@ def run() -> int32: example3() example4() example5() + example6() return 0