Console.Write("{0}{1}", intJaggedArray3[i][j], j == (intJaggedArray3[i].Length - 1) ? "" : " ");
sir i don't understand the line:
j == (intJaggedArray3[i].Length - 1) ? "" : " "
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manish Kumar ChoudharyPosted Jan 15, 2015, 11:04 PM
j == (intJaggedArray3[i].Length - 1) ? "" : " "
this is conditional statement in which intJaggedArray3[i].Length – 1 getting an array length -1 if its try it print nothing also its false it will print nothing.
This is what this line is doing
Note:-The conditional operator (?:) returns one of two values depending on the value of a Boolean expression. Following is the syntax for the conditional operator.
condition ? first_expression : second_expression;
However, the high-level ternary statement is useful because it allows you to condense multiple if-statements and reduce nesting. It does not actually eliminate branching. It simplifies the high-level representation of the branching.
{{Sandeep BanerjeePosted Jan 15, 2015, 11:19 PM