<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for your response. In the example I worked out together with one of my students we started with the number variable set equal to 129.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The student begins with a list containing the numbers 20, 10, 5 and 1.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Using an "all in order" loop:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
We divided 129 by the 20 from a list we made. We got 6 after converting to an int. We used the add to the end of the list assignment operator to make 6 the first value of a second, empty list.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Then we subtracted 20 * 6 from 129 and replaced the old value of 129 with the new value of 9.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Next, we divided 9 by 10 and got 0,<i> <b>but instead of Alice adding 0 to the list, it added false!</b></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Next, we subtracted 10 * 0 from 9 to get the "updated" value of 9 (which is the same value that would have been there from the last round).</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Then we divided 9 by 5 and got 1 (as an int), <i><b>but instead of Alice adding 1 to the list, it added true!</b></i></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This is what we were wondering about: Is this an error on our part or is it an Alice bug?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'll take your suggestion and try filling the Alice list with zeros, but the thing with a list is that we should be able to use it when we don't know how big it's going to get. If we want to set aside an arbitrary number of slots, I think an array in java is
 filled with zeros before it's initialized by a programmer -- we can do this because we're saying in advance how big to make it --  but I thought an ArrayList (again, going but what I think happens in java) would be empty and the add() method is used to add
 to the end of the list, one at a time, using each value to initialize the list, one element at a time, growing the size of the list. With an ArrayList, there is no reason to distinguish between logical size and actual size.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for taking the time to try to help clarify what is going on in our program.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Carlos</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> alice-teachers <alice-teachers-bounces+cbovell=nburlington.com@lists.andrew.cmu.edu> on behalf of Donald Slater via alice-teachers <alice-teachers@lists.andrew.cmu.edu><br>
<b>Sent:</b> Tuesday, January 25, 2022 2:04 PM<br>
<b>To:</b> Alice Teachers <alice-teachers@lists.andrew.cmu.edu><br>
<b>Subject:</b> Re: alice-teacher A number list is being filled with booleans</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">CAUTION:  This is email originated from outside of the organization.  Please exercise caution when clicking links, opening attachments, or providing personal information.
<br>
<br>
<br>
</div>
</span></font></div>
</body>
</html>