# string interpolation

---

`interpolation` يعني **تضمين قيمة داخل نص**.
يعني إدخال قيمة متغير أو expression داخل `String` مباشرة بدون `+`.

In programming: inserting a variable/expression inside a string.

Example:

```dart
var name = 'Ali';
var age = 22;

print('My name is $name');
print('Next year I will be ${age + 1}');
```

- `$variable` لمتغير مباشر
- `${expression}` لأي عملية أو expression

**double quotes**
بتقول له متفكرش أنت اطبع اللي جواك زي ما هو

- `"hello 2+1"`  
النص يُطبع كما هو، بدون حساب.

- `"hello ${2+1}"`  
هنا يحصل **interpolation**، فيحسب `2+1` ثم يطبع الناتج.

مثال:

```dart
print("hello 2+1");      // hello 2+1
print("hello ${2+1}");   // hello 3
```

طالما شيلنا ال**double quotes** (`""`) and **single quotes** (`''`).
ابدأ فكر
أنا هطبع ناتج العملية الحسابية

```dart
print(2+1); // 3

```

يعني `${}` تقول للـ compiler/interpreter: “نفّذ اللي بداخلها ثم حطه داخل الـ string.”

[[Concatenation]]