Modelines Examples
Note that modeline can either be first or second line. It must have the format given below: -*- mode: [lang]; -*-. You can also specify tab-width.
// -*- mode: javascript; -*-
// Thanks to http://rosettacode.org/wiki/99_Bottles_of_Beer#The_simple_solution_3
var beer = 99;
while ( beer > 0)
{
document.write(beer + " bottles of beer on the wall<br>");
document.write(beer + " bottles of beer<br>");
document.write("Take one down, pass it around<br>");
document.write(( beer - 1 ) + " bottles of beer on the wall<br>");
beer--;
}
#/usr/bin/env ruby
# -*- mode: ruby; -*-
# Note: Modeline can either be on first or second line :)
# Thanks to http://rosettacode.org/wiki/99_Bottles_of_Beer#Ruby
plural = 's'
99.downto(1) do |i|
puts "#{i} bottle#{plural} of beer on the wall,"
puts "#{i} bottle#{plural} of beer"
puts "Take one down, pass it around!"
plural = '' if i - 1 == 1
if i > 1
puts "#{i-1} bottle#{plural} of beer on the wall!"
puts
else
puts "No more bottles of beer on the wall!"
end
end
Follow Me