> For the complete documentation index, see [llms.txt](https://april.gitbook.io/learning-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://april.gitbook.io/learning-js/chapter-12./12.2/12.2.2-return.md).

# 12.2.2 제너레이터와 return

* yield 문 : 제너레이터의 마지막 문이더라고 제너레이터를 끝내지 않음
* return 문 : 그 위치와 관계없이 done = true, value 프로퍼티는 return이 반환하는 값이 됨

#### 제너레이터에서는 return을 쓸 때 반환값을 쓰지 않는 습관을 들이는 것을 권장

```javascript
  function* abc() {
    yield 'a';
    yield 'b';
    return 'c';
  }

  const iter = abc();
  iter.next(); // {value: "a", done: false}
  iter.next(); // {value: "b", done: false}
  iter.next(); // {value: "c", done: false}
  
  for (let l of abc())
    console.log(l); // c 출력 안됌
```
