alice-teacher Problem with INT function??
"C. Guéganno"
gueganno.c at stjolorient.fr
Sun Aug 11 13:38:49 EDT 2013
it could be problem of type..
if NumberEntered is of type */double/* or */float/* (i.e. decimal
number) ,
NumberEntered == (int)NumberEntered is always /*false*/
(entering a whole number does not modify its type)
Your second test is good. By rearranging the equation, you modify the
types :
left side: (decimal number) - (whole number) -> the result is of
type 'decimal value'
right side : 0 is automatically interpreted as 0.0 (due to the left
side)
All the best
Claude Gueganno
http://www.st-joseph-lorient.org/
Le 11/08/2013 18:23, Deane Fistick a écrit :
>
> Hi Don,
>
> I recently downloaded Alice 2.3.5 preparing for the coming school
> year. I was pleased to see that the INT function (in advanced math) is
> now a number rather than a string.
>
> However I had some trouble getting it to work properly. I was teaching
> the kids how to check to make sure the user had entered a whole number
> when asked.
>
> */If NumberEntered = Int(NumberEntered)/* should be true if a whole
> number is entered -- but that doesn't seem to work.
>
> I did figure out a "work around" by rearranging the equation.
>
> */If NumberEntered -- Int(NumberEntered) = 0/* seems to work OK.
>
> Although we have a "work around", the first*/If/* statement is the
> most straight forward, logical approach, and I would like to use it if
> possible.
>
> Do you know of any reason why the first */If/* statement shouldn't work?
>
> I've attached a copy of the relevant part of my lesson, which includes
> more detail and pictures that may help.
>
> Thanks,
>
> Deane Fistick
>
> ECOT (Electronic Classroom Of Tomorrow)
>
>
>
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20130811/c9e9fa48/attachment.html
More information about the alice-teachers
mailing list