Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rise4Fun tutorial is out of date about nullable arrays #188

Closed
abeln opened this issue Mar 17, 2018 · 3 comments · Fixed by #3086
Closed

Rise4Fun tutorial is out of date about nullable arrays #188

abeln opened this issue Mar 17, 2018 · 3 comments · Fixed by #3086
Assignees
Labels
part: documentation Dafny's reference manual, tutorial, and other materials

Comments

@abeln
Copy link

abeln commented Mar 17, 2018

In the Arrays section of the tutorial (https://rise4fun.com/Dafny/tutorial/Guide), the first code sample with the Find method reads:

method Find(a: array<int>, key: int) returns (index: int)
   requires a != null
   ensures 0 <= index ==> index < a.Length && a[index] == key
{
   // Can you write code that satisfies the postcondition?
   // Hint: you can do it with one statement.
}

Dafny complains that array<int> is non-nullable. The error message suggests replacing it with array?<int> instead, which works.

The rest of the code samples in that section also need to be updated in the same way.

@RustanLeino
Copy link
Collaborator

Even better, leave the type as it is and delete the requires clause. Thanks for pointing this out.

@wilcoxjay wilcoxjay changed the title Out of date tutorial on Rise4Fun Rise4Fun tutorial is out of date about nullable arrays May 22, 2018
@fabiomadge
Copy link
Collaborator

@fabiomadge fabiomadge reopened this Feb 3, 2022
@atomb atomb added the part: documentation Dafny's reference manual, tutorial, and other materials label Apr 20, 2022
@davidcok davidcok self-assigned this Jul 15, 2022
@davidcok
Copy link
Collaborator

Rise4Fun is obsolete, but I did add a clarifying sentence about null arrays to the online tutorial

davidcok added a commit that referenced this issue Nov 20, 2022
Fixes #188

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>

Co-authored-by: davidcok <davidcok@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part: documentation Dafny's reference manual, tutorial, and other materials
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants