What kind of scoping does Ruby use?Static or Dynamic

N

Noyan Aydin

What kind of scoping ruby use, even if it has lots of scoping rules
which was supported by adding different parameters infront of variable
names and using different character size. We do not decide what kind of
scoping does Ruby use? Dynamic or static scoping. Thank you in advance.
 
R

Robert Klemme

What kind of scoping ruby use, even if it has lots of scoping rules
which was supported by adding different parameters infront of variable
names and using different character size. We do not decide what kind of
scoping does Ruby use? Dynamic or static scoping. Thank you in advance.

Static.

robert
 
K

Ken Bloom

What kind of scoping ruby use, even if it has lots of scoping rules
which was supported by adding different parameters infront of variable
names and using different character size. We do not decide what kind of
scoping does Ruby use? Dynamic or static scoping. Thank you in advance.

Ruby uses static scoping in the basic syntax, however the use of eval with
a binding, or instance_eval (even when hidden very deep in other
methods) can change the context in which a block or string of code is
evaluated, causing it to have different scoping from the surrounding code
(but still static).

--Ken Bloom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,585
Members
45,081
Latest member
AnyaMerry

Latest Threads

Top