IHYPRESS.NET
RUBY
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Ruby (CGI Programming) ❯ If...Else
<16>
#!/usr/bin/ruby puts "Content-type: text/html\n\n" temp = rand (15..35) humid = rand (35..95) puts "<div style='color:blue; font-size:1.3em; font-family:sans-serif;'>" puts "Temperature is " + temp.to_s + "&deg;C and humidity is " + humid.to_s + "%<br>" if temp < 20 puts "It is cool outside. " elsif temp > 26 and humid > 50 puts "It is a muggy day. " else puts "It is a comfortable day. " end print "It is very humid! " if humid > 80 puts "</div>"
Temperature is 23°C and humidity is 75%
It is a comfortable day.
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.