Sha256: 2aa221bdb09457814b3ed3e5e47e5751f297fa0424acc8082cc667cdfd869c7a
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
#! /bin/usr/env ruby # HelloWorldFizzBuzz module HelloWorldFizzBuzz # Sqlite database Module module Sqlite def connect_database @db = Sequel.sqlite # create an items table begin @db.create_table :list do primary_key :id String :language String :helloworld String :fizzbuzz end end # create a dataset from the items table @posts = @db[:list] # populate the table ## Add hello-world && fizz-buzz examples Below (In Alphabetic Order) ### A ### B ### C ### D @posts.insert(language: 'dart', helloworld: "void main() { print('hello world!'); } ", fizzbuzz: "void main() { for (var i = 1; i <= 100; i ++) { if (i % 15 == 0) { print('FizzBuzz'); } else if (i % 3 == 0) { print('Fizz'); } else if (i % 5 == 0) { print('Buzz'); } else { print(i); } } }") ### E ### F ### G ### H ### I ### J ### K ### L ### M ### N ### O ### P @posts.insert(language: 'php', helloworld: "<?php print('Hello World'); ?>", fizzbuzz: " for ($i = 1; $i <= 100; $i++) { if($i % 3 == 0 && $i % 5 ==0){ echo 'FizzBuzz<br />'; } else if($i % 3 == 0){ echo 'Fizz<br />'; } else if($i % 5 == 0){ echo 'Buzz<br />'; } else { echo $i.'<br />''; } } ") ### Q ### R @posts.insert(language: 'ruby', helloworld: "puts 'Hello, world!'", fizzbuzz: " def fizzbuzz(n) (1..n).each do |i| if i % 3 == 0 && i % 5 == 0 puts 'fizzbuzz' elsif i % 3 == 0 puts 'fizz' elsif i % 5 == 0 puts 'buzz' else puts i end end end fizzbuzz(100)") ### S ### T ### U ### V ### W ### X ### Y ### Z end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
HelloWorldFizzBuzz-0.2.0 | lib/HelloWorldFizzBuzz/sqlite.rb |