This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code: | |
class Out | |
def Array.new | |
[1,2,3] | |
end | |
end | |
puts Out | |
Error: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set variables for counting | |
n = 1_i64 | |
x = 1_i64 | |
y = 1_i64 | |
loop do | |
n = x+1 | |
puts "---start---" | |
puts n #this prints the current iteration number and the start comment | |
y = n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inc = 1 #the counter variable | |
until inc == 101 #repeats until inc equals 101 | |
if inc % 3 == 0 && inc % 5 != 0 #check if inc is a multiple of three and not five and do what is on the next line | |
puts "Fizz" #prints Fizz if the above is true | |
end #end if | |
if inc % 5 == 0 && inc % 3 != 0 #check if inc is a multiple of five and not three and do what is on the next line | |
puts "Buzz" #prints Buzz if the above is true | |
end #end if | |
if inc % 5 == 0 && inc % 3 == 0 #check if inc is a multiple of three and five and do what is on the next line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "./haikubot/*" | |
require "../lib/sylcnt.cr" | |
require "../lib/discordcr/src/discordcr" | |
# TODO write explination of commands and code | |
module Haikubot | |
config = File.read_lines("./haiku.conf") | |
puts config[0] | |
client = Discord::Client.new(token: "Bot " + config[0], client_id: config[1].to_u64) | |
puts client | |
client.on_message_create do |payload| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec beer = function | |
| 0 -> print_string "No more bottles of beer on the wall, no more bottles of beer.\n" ; | |
print_string "Take one down, and pass it around, 99 bottles of beer on the wall.\n\n" | |
| 1 -> print_string "1 bottle of beer on the wall, 1 bottle of beer.\n" ; | |
print_string "Take it down, and pass it around, no more bottles of beer on the wall.\n\n" | |
| n -> Printf.printf "%d bottles of beer on the wall, %d bottles of beer.\n" n n ; | |
Printf.printf "Take one down, and pass it around, %d bottles of beer on the wall.\n\n" (n - 1); | |
beer (n - 1) | |
in beer 99 ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-module (discord) | |
#:use-module (guix packages) | |
#:use-module (guix download) | |
#:use-module (guix build-system trivial) | |
#:use-module (gnu packages base) | |
#:use-module (gnu packages bootstrap) | |
#:use-module (gnu packages xml) | |
#:use-module (gnu packages elf) | |
#:use-module (gnu packages compression) | |
#:use-module (gnu packages linux) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(lambda). | |
-export([beer/0]). | |
beer() -> | |
Fun = | |
fun | |
BeerFun(N) when N =:= 0 -> | |
io:format("No more bottles of beer on the wall, no more bottles of beer.~n"), | |
io:format("Go to the store and buy some more, 99 bottles of beer on the wall.~n~n"); | |
BeerFun(N) when N =:= 1 -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar *list* '((1 "Harry Potter And The Half Blood Prince") | |
(0 "Harry Potter And The Chamber Of Secret") | |
(3 "Healthy Eaters") | |
(0 "Hardship Posting") | |
(1 "Vogue Patterns") | |
(4 "The Kirbhiz Pattern") | |
(2 "Stromy Weather"))) | |
(defun all-positions (needle haystack) | |
(loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*REXX program generates and displays a number triangle for partitions of a number. */ | |
numeric digits 400 /*be able to handle larger numbers. */ | |
parse arg N .; if N=='' then N=25 /*N specified? Then use the default. */ | |
@.=0; @.0=1; aN=abs(N) | |
if N==N+0 then say ' G('aN"):" G(N) /*just do this for well formed numbers.*/ | |
say 'partitions('aN"):" partitions(aN) /*do it the easy way.*/ | |
exit /*stick a fork in it, we're all done. */ | |
/*──────────────────────────────────────────────────────────────────────────────────────*/ | |
G: procedure; parse arg nn; !.=0; mx=1; aN=abs(nn); build=nn>0 | |
!.4.2=2; do j=1 for aN%2; !.j.j=1; end /*j*/ /*generate some shortcuts.*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar *list* '((1 "Harry Potter And The Half Blood Prince") | |
(0 "Harry Potter And The Chamber Of Secrets") | |
(3 "Healthy Eaters") | |
(0 "Hardship Posting") | |
(1 "Vogue Patterns") | |
(4 "The Kirbhiz Pattern") | |
(2 "Stromy Weather"))) | |
(defvar *list-new* '("apple" "pepsi" "test")) |
OlderNewer