``````koi + Program

fn + Main :args begin
puts "Hello, World!";
end;
``````
``````"Hello " ^ "World!";  # becomes 'Hello World!'
"1 + " ^ 2;  # becomes '1 + 2' note, no arithmetic takes place
"something " ^ " with another " ^ " and another";  # becomes 'something with another and another'
``````
``````6
2
3.14
0.2f         # the 'f' explicitly tells the KFC that it's a floating-point number
-6.6667      # negative number
5 * 2 + 1    # arithmetic example, result: 11
11 % 7       # modulus operator, result: 4
2 - 6 / 2    # division and subtraction, result: -1
``````
``````TRUE
FALSE
``````
``````[]    # empty list
[2,3,5]    # list with number values 2,3,5
["Tyler", TRUE, -1, "FishyFishy", [2,1,"hello"],3.14f]    # list with another list
``````
``````def pi = 3.24;
def firstName = "tyler";
def result = 1 + 3;
def superAwesome = TRUE;
def fullName = "Tyler" ^ "Hoersch";
``````
``````def x = 0;

if x == 0 then
x = 1;
end;
``````
``````def y = 0;

if y < 0 then
y = 99;
else
y = 1;
if y >=1 then
y = 2;
end;
end;
``````
``````def i = 0;
for i to 10 begin
puts i;
end;
``````
``````def x = 0;
while x <= 100 do
x = x + 1;
if x % 2 == 0 then
puts x;
end;
end;
``````
``````koi + Program

fn + Main :args begin
call getGreeting;
end;

fn - getGreeting begin
puts "Hello, World -- From a Function";
end;
``````
``````koi + Program

fn + Main :args begin
def x = 2;
end;

fn - adder :a : b begin
return a + b;
end;
``````
``````def thingsToBuy = ["Eggs", "Milk", "Bread", "Sweet, Sweet Bacon"];
puts call thingsToBuy => push :"More Bacon"
=> push :"Frozen Pizza"
``````
``````koi + Person

def - firstName = "";
def - lastName = "";
def - age = 0;
def - pets = [];

fn + Initialize :first :last :a begin
firstName = first;
lastName = last;
age = a;
pets = [];
end;

fn + getPets begin
return pets;
end;

return "BaconStrips";
end;
``````
``````koi + Program

fn + Main :args begin
def myles = alloc Person :"Myles" :"Hoersch" :5;   # myles is a reference
call myles => getPets => push :"Sarge"             # adds "Sarge" to myles' pets list
end;
``````
``````koi + Program

fn + Main :args begin
call self => printMeSomethingWorthy;  # self references Program in this case
end;

fn - printMeSomehtingWorthy begin
puts "bacon, bacon, bacon";
end;
``````
``````koi + Program

fn + Main :args begin
try
def x = 0;
raise :memoryException :"Oh Noes! Memories!";
handle :memoryException
puts "A memory exception has occurred";
handle
puts "A generic exception happened!";
finally
puts "I always execute!";
end;
end;
``````