Skip to content

Commit 411d0bb

Browse files
authored
Update dot_product.dana (var-def must not be inside the block of the function but in the local def) (#76)
⟨local-def⟩ ::= ⟨func-def⟩ | ⟨func-decl⟩ | ⟨var-def⟩ ⟨var-def⟩ ::= “var” (⟨id⟩)+ “is” ⟨type⟩ According to the grammar of Dana, all var definitions must be in the local-def and not inside the block of the function.
1 parent 4b9cc01 commit 411d0bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dana/programs/dot_product.dana

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def main
1010
return : product
1111

1212
var ex_vector1 ex_vector2 is int[4]
13+
var result is int
1314

1415
ex_vector1[0] := 2
1516
ex_vector1[1] := 4
@@ -21,7 +22,6 @@ def main
2122
ex_vector2[2] := 5
2223
ex_vector2[3] := 7
2324

24-
var result is int
2525
result := dot_product(4, ex_vector1, ex_vector2)
2626
writeString : "The dot product of the two vectors is: "
2727
writeInteger : result

0 commit comments

Comments
 (0)