alice-teacher Problem with INT function??
Deane Fistick
deane.fistick at ecotoh.org
Mon Aug 12 12:50:09 EDT 2013
Thanks Claude,
I think you're on the right "track". I will continue to suggest the "rearranged" formula for now.
Strangely, a simple version of the program that Don Slater sent me (made on his Mac) runs correctly on my Windows machine.
Deane
From: alice-teachers-bounces+deane.fistick=ecotoh.org at lists.andrew.cmu.edu [mailto:alice-teachers-bounces+deane.fistick=ecotoh.org at lists.andrew.cmu.edu] On Behalf Of "C. Guéganno"
Sent: Sunday, August 11, 2013 1:39 PM
To: Alice educators
Subject: Re: alice-teacher Problem with INT function??
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<mailto: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/20130812/8446d8e1/attachment.html
More information about the alice-teachers
mailing list