IHYPRESS.NET
RUBY
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Ruby (CGI Programming) ❯ Functions 2
<11>
#!/usr/bin/ruby -w print "Content-type: text/html\n\n" def say_hi (name) puts "<div>Hello, " + name + " how are you?</div>" end def sum(a,b) a + b end puts "<div style='color:#cc0000;font-size:2.0em;'>" say_hi ("Fred") say_hi ("Wilma") x = "Barney" say_hi (x) sum1 = sum 10,20 sum2 = sum 55,22 puts "sum1= " + sum1.to_s + "<br>" puts "sum2= " + sum2.to_s puts "</div>"
Hello, Fred how are you?
Hello, Wilma how are you?
Hello, Barney how are you?
sum1= 30
sum2= 77
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.