How do i do a if statement with arrays


Joined
Jan 8, 2022
Messages
11
Reaction score
0
here is the code. what am i doing wrong?

if (arnFileNums[0], arnFileNums[1] == arnFileNums[2], arnFileNums[3], == arnFileNums[4], arnFileNums[5]);

{

}
 
Ad

Advertisements

Joined
Mar 3, 2021
Messages
243
Reaction score
29
What're you trying to compare? You can only compare one index at a time, then use && (ANDs) and || (ORs) to combine the logic, so:
Java:
if (arnFileNums[0] == arnFileNums[2] && arnFileNums[1] == arnFileNums[3]){
}
Etc. You've also got an errant semicolon at the end of the line there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top