PDA

View Full Version : What is a value in Alice?


InuyashaX5
09-28-2010, 03:00 PM
So right now I'm trying to answer a question for some homework in Alice, and I'm getting stumped on these questions. I have an idea what it means, but I'm not sure if I'll be answering them correctly. They are as follows:

---
What type of value is returned by each of the following built-in functions?
(A) distance to
(B) is within threshold of
(c) is wider than
(d) width

What type of function value is used to check a condition in an If/Else statement?
---

I know a value is a answer in a function, but I don't know what kind of answer it's looking for and it's really bugging me. If anyone can shred some light on this for me, I'd appreciate it.

debussybunny563
09-28-2010, 04:19 PM
I assume that they mean, what type of variable (like number/numerical, boolean, object, etc.).

So, if it was "height," it would be a number value.

Dameria
09-28-2010, 05:03 PM
Yes, what debussybunny said, and if you want more help:

Variables:
Number - a placeholder containing a numerical value
Boolean - a placeholder containing describing either true or false

Those are all the two you need to answer those 4 parts, a through d, but if you want a few others just so you know:

String (is actually an object in Java, not a variable) - a placeholder containing multiple characters
char (not in Alice, but in Java) - a placeholder containing a single character value (example: a, A, b, B, 3, 9)

There are also multiple numerical type variables in real Java that are not technically shown in Alice. In Alice, they just tell you "Number" variable, however there is actually:

int - an integer type number value containing no decimals
long - an even larger integer type number value containing no decimals
(used for distances such as miles from the Earth to the other planets, or other such large number)
float - a number value containing a small amount of decimals
double - a number value containing a larger amount of available decimal places (used more often, especially for money)
And I think there is byte, which is really small, containing only 1 byte of memory, but nobody ever uses that anymore.