What is the syntax for defining a method in Ruby?
روبی میں طریقہ کی وضاحت کے لیے نحو کیا ہے؟
- def method_name
- method method_name
- function method_name
- define method_name
Explanation
In Ruby, the syntax for defining a method is:
def method_name(parameters)
# method body
end
The 'def' keyword is used to define a method, followed by the method name and parameters in parentheses.
The method body is indented and enclosed by the 'end' keyword.
Related MCQs
خام حقائق اور اعداد و شمار کے مجموعے کو کیا کہتے ہیں؟
- Information
- Data
- Processing
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
کمپیوٹر سیکیورٹی میں ہیشنگ اور انکرپشن کے درمیان بنیادی فرق کیا ہے؟
- Hashing is reversible, while encryption is irreversible
- Hashing is one-way, while encryption is reversible with a key
- Both hashing and encryption are one-way processes
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
او ایس آئی ماڈل میں کون سی لئیر منطقی ایڈریسنگ اور مختلف نیٹ ورکس کے درمیان پیکٹس کی روٹنگ کی ذمہ دار ہوتی ہے؟
- Network Layer
- Data Link Layer
- Transport Layer
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
مندرجہ ذیل میں سے کون سا ان پٹ اور آؤٹ پٹ آلہ ہے؟
- Modem
- Touchscreen
- Both A and B
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
ای میل کا مطلب کیا ہے؟
- Easy mail
- Electronic mail
- Electric mail
- Eye mail