Is it possible?
Example:
int x = 100, 200, 300;
or
int x =100  200  300
Is it possible?
Example:
int x = 100, 200, 300;
or
int x =100  200  300
No, it isn't possible. What are you trying to do?
It's possible to have an array of integers:Code:int nums[] = {1,2,3};
“Who were you, Krilnon, and how did you know so much about AS4?”
The historian sighed as she gazed up at the sky and saw… not stars. A story.
I need to make int x equal to three different numbers. And my function must always consider each of those three numbers at the same time.
I need to say this:
x = 100  200  300
if(y > x) {dothis}
else if(y < x) {dothis}
where y will always be a random number. No, I can't just do x = 100 and y > x. It's important that x equal three numbers.
x can't equal three numbers, think of it this way:
If x = 100 and x = 200, then 100 = 200 which is a contradiction.. therefore x cannot equal 100 and 200.
What is it that you're trying to do?
Try either an array or just three different variables:
x = 100
z = 200
a = 300
if (y > x  y > z  y > a) {do this}
else {do this}
You can do the same by going through an array with a for loop, but if you only have three ints that's a little much.
The question is whether one of the conditions returning true is sufficient, or if all three conditions must be true. That will change the code a little.
Your best bet ( like everyone else has mentioned) is to create an array. That is the only way I can think of to compare 1 type with 3 values.
int numbs[] = {100,200,300};
if (y > numbs[0]  y > numbs[1]  y > numbs[2]){
// do this code
}
..... etc
or you can do what battie said and create 3 individual ints.
Whats the purpose of having 3 values in one int?
Well, if y is greater than the smallest integer, then technically, doesn't it encompass all of the possible x values?
got pwnt?
I think your best bet is to put each of the values you want x to take into an array as x and then loop over each of these values and call your function with that value (assuming you don't need to use more than one value at a time  in which case your loop should be within your function and it should take an array as it's parameter).
Most programming languages don't work with vectors  perhaps you're used to working with maple or some other maths package but unfortunately you'll need to work with loops now instead.
Note that my java sucks.Code:void test (x) { if (x > 100) { // ... } else if (x < 50) { // ... } } int i; int x[] = {10,20,30,40,50,60,70,80,90,100}; for (i=0; i<x.length; i++) { test(x[i]); }
"60% of the time it works... every time."  Paul Rudd as Brian Fantana.
There are currently 1 users browsing this thread. (0 members and 1 guests)
