IRB (इंटरैक्टिव Ruby)
IRB Ruby के लिए एक chat window है जहाँ आप एक line type करते हैं और तुरंत एक answer पाते हैं। यह ideas try करने के लिए एक scratch pad जैसा है।
In this page:
Syntax
irb
irb(main):001> expression
IRB (Interactive Ruby)
IRB Ruby का interactive console है, एक terminal में irb type करके शुरू होता है, जहाँ आप expressions type कर सकते हैं और तुरंत results देख सकते हैं। बिना एक file बनाए Ruby के छोटे snippets experiment करने का यह सबसे fast तरीका है।
हर expression का result automatically print होता है, एक calculator जैसा।
Note:
एक IRB session छोड़ने के लिए
exit type करें या Ctrl+D दबाएँ।उदाहरण: IRB (Interactive Ruby)
# Simulating what you'd see interacting with irb:
puts "2 + 2 = #{2 + 2}"
puts "In irb, typing '2 + 2' alone would print '=> 4' automatically"
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- IRB में एक multi-line method type करना और जल्दी Enter दबाना, definition बहुत जल्दी खत्म करते हुए।
- यह मान लेना कि IRB छोड़ने के बाद variables रहते हैं, जब
exitपर session state खो जाता है। - यह उम्मीद करना कि
=> 4printed output है, जब यह expression की return value है, जबकिputsoutput की अपनी line होती है।
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: