Basic Examples
Basic WhyPY Examples
This guide provides basic examples of WhyPY programming to help you start your mystical journey.
Interactive Examples
1. Hello, Mystic World
manifest greeting with "Greetings, seeker of truth" seal
manifest sayHello with rune(name) unfold manifest message with greeting augments name seal yield message sealfold seal
sayHello("mystic one") seal2. Basic Arithmetic
// Basic calculationsmanifest x with 5 sealmanifest y with 10 seal
manifest sum with x augments y sealmanifest difference with x diminishes y sealmanifest product with x conjoins y sealmanifest quotient with y divide x seal
// More complex expressionmanifest result with (x augments y) conjoins 2 seal3. Conditional Logic
manifest age with 25 seal
whence (age ascends 18) unfold yield "You are wise enough" sealfold elsewise unfold yield "Seek more wisdom" sealfold4. Simple Loop Using Recursion
manifest fibonacci with rune(n) unfold whence (n descends 2) unfold yield n seal fold
yield fibonacci(n diminishes 1) augments fibonacci(n diminishes 2) sealfold seal
manifest result with fibonacci(10) seal5. Basic Function (Ritual) Usage
// Define a simple ritualmanifest double with rune(x) unfold yield x conjoins 2 sealfold seal
// Use the ritualmanifest result with double(5) seal // Results in 106. Truth Values
manifest isTrue with verity sealmanifest isFalse with fallacy seal
// Logical operationsmanifest notTrue with negate isTrue sealmanifest comparison with 5 descends 10 seal7. Basic Composition
manifest addOne with rune(x) unfold yield x augments 1 sealfold seal
manifest multiplyByTwo with rune(x) unfold yield x conjoins 2 sealfold seal
// Compose the ritualsmanifest result with multiplyByTwo(addOne(5)) sealNext Steps
Once you’re comfortable with these basic examples, proceed to:
- Advanced Examples for more complex patterns
- Design Patterns for common programming patterns in WhyPY (Coming Soon)
Remember to always seal your statements and maintain the flow of mystical energy in your code!