dart-lang / dart-lang/language

if expressions

Open
#3,374 26 comments 75 reactions 0 assignees View on GitHub
feature
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

You already introduced switch expressions. Are you planning to add if expressions?

Syntax examples:
```dart
var x = if (a > 0) return 1; else return 2;
```
```dart
var x = if (a > 0) {
return 1;
} else if (b < 10) {
return 2;
} else {
return 3;
}
```
Currently we have only `x ? y : z` operator, but it's not enough if we want more advanced branching.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing switch expressions referenced in the issue and compare them with the proposed if-expression syntax examples. Clarify the language-design requirements, including branching and return behavior, before determining whether the proposal is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.