Convert single backtick code sections to triple backtick code sections for Arabic Guide articles (13 of 15) (#36240)

* fix: converted single to triple backticks13

* fix: added prefix

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: removed language in wrong place

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add language postfix

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: removed language in wrong place

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
Randell Dawson
2019-06-20 16:07:24 -07:00
committed by Tom
parent db4d4a1b34
commit d6a160445e
75 changed files with 2195 additions and 1889 deletions

View File

@@ -23,24 +23,25 @@ localeTitle: المهام
5. بعض كتلة من التعليمات البرمجية للتنفيذ
6. بيان الإرجاع (اختياري)
`# a function with no parameters or returned values
def sayHello():
print("Hello!")
sayHello() # calls the function, 'Hello!' is printed to the console
# a function with a parameter
def helloWithName(name):
print("Hello " + name + "!")
helloWithName("Ada") # calls the function, 'Hello Ada!' is printed to the console
# a function with multiple parameters with a return statement
def multiply(val1, val2):
return val1 * val2
multiply(3, 5) # prints 15 to the console
`
```python
# a function with no parameters or returned values
def sayHello():
print("Hello!")
sayHello() # calls the function, 'Hello!' is printed to the console
# a function with a parameter
def helloWithName(name):
print("Hello " + name + "!")
helloWithName("Ada") # calls the function, 'Hello Ada!' is printed to the console
# a function with multiple parameters with a return statement
def multiply(val1, val2):
return val1 * val2
multiply(3, 5) # prints 15 to the console
```
دالات هي كتل من التعليمات البرمجية التي يمكن إعادة استخدامها ببساطة عن طريق استدعاء الدالة. ويتيح ذلك إعادة استخدام الشفرة البسيطة والأنيقة دون إعادة كتابة أجزاء من التعليمات البرمجية بشكل صريح. هذا يجعل التعليمات البرمجية أكثر قابلية للقراءة ، مما يجعل تصحيح الأخطاء أسهل ، ويحد من أخطاء الكتابة.
@@ -50,43 +51,48 @@ localeTitle: المهام
يتم استخدام اسم الدالة لاستدعاء الدالة ، تمرير المعلمات المطلوبة داخل الأقواس.
`# this is a basic sum function
def sum(a, b):
return a + b
result = sum(1, 2)
# result = 3
`
```python
# this is a basic sum function
def sum(a, b):
return a + b
result = sum(1, 2)
# result = 3
```
يمكنك تعريف القيم الافتراضية للمعلمات ، وبهذه الطريقة سوف تفسر بايثون أن قيمة هذه المعلمة هي القيمة الافتراضية إذا لم يتم تحديد أي منها.
`def sum(a, b=3):
return a + b
result = sum(1)
# result = 4
`
```python
def sum(a, b=3):
return a + b
result = sum(1)
# result = 4
```
يمكنك تمرير المعلمات بالترتيب الذي تريده ، باستخدام اسم المعلمة.
`result = sum(b=2, a=2)
# result = 4
`
```python
result = sum(b=2, a=2)
# result = 4
```
ومع ذلك ، لا يمكن تمرير وسيطة الكلمات الرئيسية قبل كلمة غير أساسية
`result = sum(3, b=2)
#result = 5
result2 = sum(b=2, 3)
#Will raise SyntaxError
`
```Python
result = sum(3, b=2)
#result = 5
result2 = sum(b=2, 3)
#Will raise SyntaxError
```
وظائف هي أيضا كائنات ، لذلك يمكنك تعيينها لمتغير ، واستخدام هذا المتغير مثل وظيفة.
`s = sum
result = s(1, 2)
# result = 3
`
```python
s = sum
result = s(1, 2)
# result = 3
```
### ملاحظات