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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Jan 15, 2015, 6:04 PM EST
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 BanerjeeRank #4,887 · 320 reputationPosted Jan 15, 2015, 6:19 PM EST