Shining Ruby

liuxd

Title Text

<?php

function sayHello($name) {
    return 'Hello! ' . $name;
}

var_dump(sayHello('2345'));
def sayHello name
    'Hello! ' + name
end

p sayHello '2345'
<?php

$i = 0;

while ($i < 3) {
    echo '2345';
    $i++;
}
3.times do
    p '2345'
end
# Example for multi-threads.

def main
    thread_pool = []

    5.times do |t|
        thread_pool.push Thread.new{ process t}
    end

    thread_pool.each {|th| th.join}
end

def process message
    puts message
end

main

Other

  • rvm
  • gem
p 'thx'

Shining Ruby

By liuxd

Shining Ruby

  • 979