seniorRuby

What is the difference between Ruby execution in script mode vs REPL (IRB)?

Updated May 17, 2026

Short answer

Script mode executes full file; IRB evaluates expressions interactively with persistent context.

Deep explanation

In script mode, Ruby parses and executes the entire file. In IRB, each line is evaluated in an interactive session with persistent bindings, allowing incremental execution and introspection.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Ruby interview questions

View all →