source: CIVL/examples/languageFeatures/sumExpression.cvl

main
Last change on this file was b3cd4ba, checked in by Alex Wilton <awilton@…>, 3 months ago

Changed syntax of $sum to be more like $forall

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@6003 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 223 bytes
Line 
1$input int N;
2$assume(N > 0 && N <= 10);
3$input int a[N];
4
5int main() {
6 int sum = 0;
7 for (int i = 0; i < N; i++) {
8 sum += a[i] + 1;
9 }
10 $assert(sum == $sum(int t : 0 .. N-1) a[t] + 1);
11 return 0;
12}
Note: See TracBrowser for help on using the repository browser.