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
آپ کا اکاؤنٹ کھولنے کے لیے درج ذیل میں سے کون سا استعمال کیا جا سکتا ہے؟
- Sing in
- Log in
- Sing out
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
ریم کونسی میموری ہے؟
- Permanent
- Volatile
- Primary Memory
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
سافٹ ویئر کی خرابیوں کا عام نام کیا کہلاتا ہے
- Bugs
- Viruses
- Logic Bombs
- Trojans
اس سوال کو وضاحت کے ساتھ پڑھیں
پروگرام میں غلطیاں درست کرنے کوکیا کہا جاتا ہے
- Modifying
- Rectifying
- Bugging
- Debugging
اس سوال کو وضاحت کے ساتھ پڑھیں
- Primary Memory
- Secondary Memory
- Volatile Memory
- Cache Memory