Learn SHAKESPEARE with Real Code Examples
Updated Nov 26, 2025
Code Sample Descriptions
1
Hello World in SPL
The Infamous Hello World Play.
Romeo, a young man with remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Act I: The Beginning.
Scene I: The First Encounter.
[Enter Romeo and Juliet]
Romeo: You are as lovely as the sum of a cat and a fine day.
Juliet: Speak your mind!
Romeo: Speak your mind!
[Exeunt]
A Shakespeare program that prints 'Hello World'. Characters are variables, and dialogue acts as operations.
2
Simple Addition in SPL
A Simple Addition Play.
Romeo, a young man with remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Act I: Numbers.
Scene I: Adding Them Up.
[Enter Romeo and Juliet]
Romeo: You are as sweet as the sum of yourself and a charming lady.
Juliet: Speak your mind!
Romeo: Open your heart!
[Exeunt]
Adds two numbers using character variables and prints the result.
3
Conditional Example in SPL
A Conditional Play.
Romeo, a young man of strong disposition.
Juliet, a young lady with a gentle heart.
Act I: Testing.
Scene I: Choices.
[Enter Romeo and Juliet]
Romeo: Am I better than a cat?
Juliet: If so, speak your mind!
Romeo: Else, open your heart!
[Exeunt]
Uses SPL dialogue to perform a conditional operation.
4
Loop Example in SPL
A Looping Play.
Romeo, a man of boundless energy.
Juliet, a lady of patience.
Act I: Repetition.
Scene I: Endless Dialogue.
[Enter Romeo and Juliet]
Romeo: You are as lovely as the sum of yourself and a charming lady.
Juliet: Open your heart!
Romeo: Speak your mind!
Juliet: Let us return to the start.
[Exeunt]
Demonstrates looping by repeatedly modifying a variable.
5
Multiplication Example in SPL
A Multiplying Play.
Romeo, a man with fiery temper.
Juliet, a lady of extreme kindness.
Act I: Multiply.
Scene I: The Task.
[Enter Romeo and Juliet]
Romeo: You are as lovely as the sum of yourself and a noble cat.
Juliet: Speak your mind!
Romeo: Open your heart!
[Exeunt]
Multiplies two numbers using character interactions.
6
Decrement Example in SPL
A Decrementing Play.
Romeo, a man of temper.
Juliet, a lady of caution.
Act I: Reduce.
Scene I: The Change.
[Enter Romeo and Juliet]
Romeo: You are as vile as the difference between yourself and a noble lord.
Juliet: Speak your mind!
[Exeunt]
Decreases a variable value using SPL dialogue commands.
7
Compare Numbers in SPL
A Comparing Play.
Romeo, a man of intellect.
Juliet, a lady of wit.
Act I: Judgment.
Scene I: Comparing.
[Enter Romeo and Juliet]
Romeo: Am I as lovely as Juliet?
Juliet: If so, speak your mind!
Romeo: Else, open your heart!
[Exeunt]
Compares two variables and acts based on the comparison.
8
String Output Example in SPL
A String Output Play.
Romeo, a man of words.
Juliet, a lady of grace.
Act I: Writing.
Scene I: Spelling.
[Enter Romeo and Juliet]
Romeo: You are as lovely as the sum of a cat and a charming lady.
Juliet: Speak your mind!
Romeo: Speak your mind!
Juliet: Speak your mind!
[Exeunt]
Uses dialogue to produce a string output character by character.
9
Nested Condition Example in SPL
A Nested Conditional Play.
Romeo, a man of judgment.
Juliet, a lady of insight.
Act I: Decisions.
Scene I: Nesting.
[Enter Romeo and Juliet]
Romeo: Am I better than a cat?
Juliet: If so, speak your mind!
Juliet: Else, if not, open your heart!
Romeo: Speak your mind!
[Exeunt]
Demonstrates nested conditions using SPL dialogue.
10
Increment Example in SPL
An Incrementing Play.
Romeo, a young man of energy.
Juliet, a young lady of patience.
Act I: Counting.
Scene I: Additions.
[Enter Romeo and Juliet]
Romeo: You are as lovely as the sum of yourself and a charming lady.
Juliet: Open your heart!
Romeo: Open your heart!
Juliet: Open your heart!
[Exeunt]
Increments a variable multiple times using character dialogue.