# Unit 5 Lesson 4 (U5L4) RemindMe code

**URL:** <https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814>\
**Category:** Coding and Debugging Help\
**Tags:** csp-unit-5\
**Created:** [December 1, 2020, 8:30pm UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814 "2020-12-01T20:30:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbowman](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@rbowman](https://forum.code.org/u/rbowman)\
**Post date:** [December 1, 2020, 8:30pm UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/1 "2020-12-01T20:30:37Z")

</div>

I am looking at the same code to create the Reminder List in U5 L4. I want to know what does index++ and index–; do in the code for left button and right button? Does it meant to scroll 1 less or 1 more click?

What code is for the “counter pattern with Boundary”? What does that mean?

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [December 2, 2020, 4:28am UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/2 "2020-12-02T04:28:26Z")

</div>

`index++` adds 1 to the value of index and assigns it to index while evaluating to the value before adding 1. It is similar to `index = index + 1;` There is a difference in that if you set index to 3 say; `index = 3;` and then assign it to x like this `x = index++` The value of x is 3 and the value of index is 4.

On the other hand `++index` adds one to index and evaluates to the new value. So `index = 3;` and then assign it to x like this `x = ++index` The value of x is 4 and the value of index is also 4.

So be careful how you use `x++` as an expression. It may not do what you think, `++x` does what you think.

`index--` is the same except subtract 1.

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [December 2, 2020, 4:35am UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/3 "2020-12-02T04:35:46Z")

</div>

Counter pattern with boundry is just the counter pattern with limits on how high or how low it can go.

 ![a76dac0ea446c5a4b382020186a1e476-image-1558635805735](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/f/fc1e5cfa6c9c2f9215fae381c5a687a8d8af7fd1.png)

So looking at this code what we see is a test to see if `index > 0` and if so go ahead and decrement the counter. It will never go lower than 0. The first item in the list.

We also see a test to see if `index < myList.length - 1` and then `index++`. That means index will never be more than the last item in the list.

---

<div class="post-metadata">

**Author:** ![erogers](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@erogers](https://forum.code.org/u/erogers)\
**Post date:** [December 4, 2020, 12:33am UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/4 "2020-12-04T00:33:54Z")

</div>

Thank you for explaining this! The index++ and index-- are not introduced in the lessons before this, at least not that I’ve seen. But the example answer for this lesson recommends them for the RemindMe app. The same with the boundary pattern. Could someone add those to the units?

---

<div class="post-metadata">

**Author:** ![bhatnagars](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/bhatnagars/32/4919_2.png) [@bhatnagars](https://forum.code.org/u/bhatnagars)\
**Post date:** [December 4, 2020, 12:53am UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/5 "2020-12-04T00:53:51Z")

</div>

I will pass on your request to [code.org](http://code.org)

---

<div class="post-metadata">

**Author:** ![ken](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/ken/32/6111_2.png) [@ken](https://forum.code.org/u/ken)\
**Post date:** [December 17, 2020, 8:05pm UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/6 "2020-12-17T20:05:15Z")

</div>

@erogers Sorry I’m just responding to this. I have logged this as a change to make for the 21-22 version of the course!

---

<div class="post-metadata">

**Author:** ![erogers](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@erogers](https://forum.code.org/u/erogers)\
**Post date:** [December 17, 2020, 8:28pm UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/7 "2020-12-17T20:28:06Z")

</div>

Thank you, Ken! I appreciate your response.

---

<div class="post-metadata">

**Author:** ![lsiegfried](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/lsiegfried/32/6300_2.png) [@lsiegfried](https://forum.code.org/u/lsiegfried)\
**Post date:** [January 6, 2021, 2:27pm UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/8 "2021-01-06T14:27:26Z")

</div>

Hello, this is only my second year of teaching CS Principles. Would someone be willing to share their code for this lesson? We are stuck in my classroom, and I’m not sure how to proceed.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [January 6, 2021, 2:51pm UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/9 "2021-01-06T14:51:54Z")

</div>

Go to Unit 5 lesson 4 bubble 3. Open the teacher panel. There is a button to get the example solution.

---

<div class="post-metadata">

**Author:** ![lsiegfried](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/lsiegfried/32/6300_2.png) [@lsiegfried](https://forum.code.org/u/lsiegfried)\
**Post date:** [January 6, 2021, 2:59pm UTC](https://forum.code.org/t/unit-5-lesson-4-u5l4-remindme-code/33814/10 "2021-01-06T14:59:54Z")

</div>

Well that’s helpful! Thank you!
