Skip to content

Commit 661af04

Browse files
authored
Merge pull request #1474 from manishpatelUK/patch-1
Small note to describe Nil
2 parents ad8c330 + a56f7af commit 661af04

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

_tour/generic-classes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class Stack[A] {
2828
```
2929
This implementation of a `Stack` class takes any type `A` as a parameter. This means the underlying list, `var elements: List[A] = Nil`, can only store elements of type `A`. The procedure `def push` only accepts objects of type `A` (note: `elements = x :: elements` reassigns `elements` to a new list created by prepending `x` to the current `elements`).
3030

31+
`Nil` here is an empty `List` and is not to be confused with `Null`.
32+
3133
## Usage
3234

3335
To use a generic class, put the type in the square brackets in place of `A`.

0 commit comments

Comments
 (0)