Follow-up · depth 5
How would you explain Built-in Control Flow @if @for @switch to a junior engineer?
How would you explain Built-in Control Flow @if @for @switch to a junior engineer?
Answers use simple, clear English.
Audio N/AQuick interview answer
Explain Built-in Control Flow @if @for @switch in one sentence, then a tiny example, then one “don’t do this” tip. At Senior depth: start with the problem, then mechanism, then a short example. New template syntax replaces *ngIf/*ngFor for many cases: @if, @for (with track), @switch.
Detailed answer
Junior-friendly explanation of Built-in Control Flow @if @for @switch: Plain English: At Senior depth: start with the problem, then mechanism, then a short example. New template syntax replaces *ngIf/*ngFor for many cases: @if, @for (with track), @switch. Tiny example: @for (item of items(); track item.id) { <li>{{ item.name }}</li> } One warning: Using index as track for reorderable lists.
Full explanation
Keep jargon low, then layer detail. New template syntax replaces *ngIf/*ngFor for many cases: @if, @for (with track), @switch. Better type narrowing and performance guidance via mandatory track.
Follow-up questions
Only answered follow-ups are shown — click to open with full answers
Parent context — Built-in Control Flow @if @for @switch
At Senior depth: start with the problem, then mechanism, then a short example. New template syntax replaces *ngIf/*ngFor for many cases: @if, @for (with track), @switch.
View full parent question →