Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
exit if RUBY_VERSION < '1.8.6'
puts bloop.abs if defined?(bloop) and bloop.respond_to?(:abs)

View file

@ -0,0 +1,23 @@
def variable_counter(b)
int_vars = []
sum = 0
check_var = lambda do |name, value|
if value.is_a?(Integer)
int_vars << name
sum += value
end
end
global_variables.each {|varname| check_var.call(varname, eval(varname.to_s))}
eval('local_variables', b).each {|varname| check_var.call(varname, eval(varname.to_s, b))}
puts "these #{int_vars.length} variables in the global scope are integers:"
puts int_vars.inspect
puts "their sum is: #{sum}"
end
an_int = 5
a_string = 'foo'
a_float = 3.14
variable_counter(binding)