Files
freeCodeCamp/guide/arabic/ruby/ruby-string-interpolation/index.md
2019-06-20 15:35:05 -05:00

30 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Ruby String Interpolation
localeTitle: روبي السلسلة الاستيفاء
---
# الاستيفاء سلسلة
يوفر الاستيفاء سلسلة صيغة أكثر قابلية للقراءة وموجزة لبناء السلاسل. قد تكون على دراية بالتسلسل عبر الطرق `+` أو `<<` :
```ruby
"Hello " + "World!" #=> Hello World
"Hello " << "World!" #=> Hello World
```
يوفر الاستيفاء سلسلة طريقة لتضمين رمز Ruby مباشرة في سلسلة:
```ruby
place = "World"
"Hello #{place}!" #=> Hello World!
"4 + 4 is #{4 + 4}" #=> 4 + 4 is 8
```
يتم تقييم كل شيء بين `#{` و `}` برمز روبي. للقيام بذلك ، يجب أن يكون محاطًا بالسلسلة علامات اقتباس مزدوجة ( `"` ).
ستقوم علامات الاقتباس المفردة بإرجاع السلسلة الصحيحة داخل علامات الاقتباس:
```ruby
place = "World"
'Hello #{place}!' #=> Hello #{place}!
```