-2

I should probably know that but I'm not sure what this line of code is doing:

int iEnd=i==grid.length - 1 ? 0:1;
Dawood ibn Kareem
  • 73,541
  • 13
  • 95
  • 104
bfg
  • 13
  • 5

1 Answers1

0

it will set iEnd to 0 if i equals grind.length -1 otherwise it will set iEnd to 1

the operator is called Ternary Operator and is a short hand for a Conditional Operator and you can read more about it here: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html

Jocke
  • 2,072
  • 1
  • 15
  • 22