Mruby is a compact implementation of the Ruby programming language with a footprint of less than 400KB that is extensible and allows calling C functions from Ruby code. Mruby/c is an implementation focused on small devices with less than 64KB of memory like one-chip microprocessors. It features small size, compatible bytecode with Mruby, and concurrent execution without an operating system. Mruby and Mruby/c are well suited for IoT software due to their small size and ability to handle networking, hardware control, concurrent programming, and the Ruby language.
6. 例
#include <stdio.h>
int main(void)
{
int i, s;
int ary[5] = {2,3,5,7,11};
s = 0;
for( i=0 ; i<5 ; i++ ){
s += ary[i];
}
printf("%d?n", s);
return 0;
}
ary = [2,3,5,7,11]
s = 0
ary.each do |x|
s = s + x
end
puts s