|
3 | 3 | <img src="felix_logo.png" alt="Felix Programming Language" width="150" height="150"> |
4 | 4 | </div> |
5 | 5 |
|
6 | | -# Felix Programming Language Guide |
| 6 | +# Welcome to Felix! 🎮 |
7 | 7 |
|
8 | | -Hey there! 👋 Let's learn how to write programs in Felix, our friendly programming language. It's easy and fun! |
| 8 | +Hi there! 👋 Let's learn how to use Felix, your new coding friend! It's super easy and fun! |
9 | 9 |
|
10 | | -## Writing Your First Program |
| 10 | +## Using the Felix IDE (Your Coding Playground) |
11 | 11 |
|
12 | | -### Variables - Like Boxes for Your Data |
13 | | -Think of variables like labeled boxes where you can store things: |
| 12 | +1. **Starting the IDE** |
| 13 | + - The Felix IDE window will pop up |
| 14 | + - This is where you'll write your code! |
| 15 | + |
| 16 | +2. **Writing Your Code** |
| 17 | + - The big white box in the middle is where you type your code |
| 18 | + - The black box at the bottom shows what your program does when it runs |
| 19 | + |
| 20 | +3. **Saving Your Work** |
| 21 | + - Click "File" at the top |
| 22 | + - Choose "Save" or "Save As" to keep your work safe |
| 23 | + - Give your file a name ending with `.fx` (like `mygame.fx`) |
| 24 | + |
| 25 | +4. **Running Your Program** |
| 26 | + - Click "Run" at the top |
| 27 | + - Choose "Run Program" |
| 28 | + - Watch what happens in the black box below! |
| 29 | + |
| 30 | +## Let's Write Some Code! 🚀 |
| 31 | + |
| 32 | +### Your First Program |
| 33 | +Try typing this in the white box: |
14 | 34 | ``` |
15 | | -x = 42 # Stores the number 42 in a box labeled 'x' |
16 | | -name = "Felix" # Stores the name "Felix" in a box labeled 'name' |
| 35 | +print "Hello! I'm coding!" |
17 | 36 | ``` |
| 37 | +Run it and see what happens! |
18 | 38 |
|
19 | | -### Printing - Showing Things on Screen |
20 | | -When you want to see what's in your variable or show a message: |
| 39 | +### Making Variables (Like Magic Boxes) |
| 40 | +Variables are like boxes where you can store things: |
21 | 41 | ``` |
22 | | -print "Hello!" # Shows "Hello!" on screen |
23 | | -print x # Shows what's in the 'x' box |
| 42 | +age = 10 |
| 43 | +name = "Felix" |
| 44 | +print age # Shows what's in the age box |
| 45 | +print name # Shows what's in the name box |
24 | 46 | ``` |
25 | 47 |
|
26 | | -### Math Operations - Calculator Stuff |
27 | | -You can do math just like with a calculator: |
| 48 | +### Math Time! 🔢 |
| 49 | +You can do math just like a calculator: |
28 | 50 | ``` |
29 | 51 | x = 5 |
30 | 52 | y = 3 |
31 | | -print x + y # Adds numbers: 5 + 3 = 8 |
| 53 | +print x + y # Adds: 5 + 3 = 8 |
32 | 54 | print x - y # Subtracts: 5 - 3 = 2 |
33 | 55 | print x * y # Multiplies: 5 * 3 = 15 |
34 | | -print x / y # Divides: 5 ÷ 3 = 1.666... |
| 56 | +print x / y # Divides: 5 ÷ 3 |
35 | 57 | ``` |
36 | 58 |
|
37 | | -### Making Decisions with IF, ELIF, and ELSE |
38 | | -You can make your program choose between different options: |
| 59 | +### Making Choices (If-Then) |
| 60 | +Tell your program to make decisions: |
39 | 61 | ``` |
40 | | -x = 5 |
41 | | -if x > 10 |
42 | | - print "x is bigger than 10!" |
43 | | -elif x > 5 |
44 | | - print "x is bigger than 5!" |
45 | | -elif x > 3 |
46 | | - print "x is bigger than 3!" |
| 62 | +age = 10 |
| 63 | +if age > 8 |
| 64 | + print "You're a big kid!" |
47 | 65 | else |
48 | | - print "x is small!" |
49 | | -``` |
50 | | - |
51 | | -The program will check each condition in order and run the first one that's true. If none are true, it will run the else part! |
52 | | - |
53 | | -### Using AND and OR |
54 | | -You can check multiple things at once: |
55 | | -``` |
56 | | -age = 12 |
57 | | -height = 150 |
58 | | -
|
59 | | -if age > 10 and height > 140 |
60 | | - print "You can ride the big roller coaster!" |
61 | | -
|
62 | | -if age < 8 or height < 120 |
63 | | - print "Please try the kiddie rides" |
| 66 | + print "You're still little!" |
64 | 67 | ``` |
65 | 68 |
|
66 | | -### Using NOT |
67 | | -You can check if something is NOT true: |
68 | | -``` |
69 | | -is_raining = 0 |
70 | | -if not is_raining |
71 | | - print "Let's play outside!" |
72 | | -``` |
73 | | - |
74 | | -### Repeating Things with WHILE |
75 | | -Want to do something over and over? Use while: |
| 69 | +### Counting with Loops |
| 70 | +Want to count numbers? Use a while loop: |
76 | 71 | ``` |
77 | 72 | count = 1 |
78 | 73 | while count < 5 |
79 | | - print count # This will print: 1, 2, 3, 4 |
| 74 | + print count # Prints: 1, 2, 3, 4 |
80 | 75 | count = count + 1 |
81 | 76 | ``` |
82 | 77 |
|
83 | | -## Fun Examples to Try |
84 | | - |
85 | | -### Counter Program |
86 | | -``` |
87 | | -count = 1 |
88 | | -while count < 5 |
89 | | - print count |
90 | | - count = count + 1 |
91 | | -``` |
92 | | -This counts from 1 to 4! |
| 78 | +## Fun Projects to Try! 🌟 |
93 | 79 |
|
94 | | -### Temperature Check |
| 80 | +### Make a Greeting Card |
95 | 81 | ``` |
96 | | -temperature = 25 |
97 | | -if temperature > 30 |
98 | | - print "It's hot today!" |
99 | | -if temperature < 15 |
100 | | - print "It's cold today!" |
| 82 | +name = "Felix" |
| 83 | +print "******************" |
| 84 | +print "* Hi, " + name + "! *" |
| 85 | +print "* You're awesome! *" |
| 86 | +print "******************" |
101 | 87 | ``` |
102 | 88 |
|
103 | | -### Functions - Making Reusable Code |
104 | | -You can create functions that do specific tasks: |
| 89 | +### Number Guessing Game |
105 | 90 | ``` |
106 | | -fun greet(name) |
107 | | - print "Hello, " + name |
| 91 | +secret = 7 |
| 92 | +guess = 5 |
108 | 93 |
|
109 | | -fun add(x, y) |
110 | | - return x + y |
111 | | -
|
112 | | -# Using the functions |
113 | | -greet("Felix") # Prints: Hello, Felix |
114 | | -result = add(5, 3) # result will be 8 |
115 | | -print result |
| 94 | +if guess < secret |
| 95 | + print "Too low!" |
| 96 | +if guess > secret |
| 97 | + print "Too high!" |
| 98 | +if guess = secret |
| 99 | + print "You got it!" |
116 | 100 | ``` |
117 | 101 |
|
118 | | -### Simple Game Score with Functions |
119 | | -``` |
120 | | -fun check_score(score) |
121 | | - if score > 90 |
122 | | - return "You're a superstar!" |
123 | | - if score > 80 |
124 | | - return "Great job!" |
125 | | - return "Keep practicing!" |
126 | | -
|
127 | | -score = 85 |
128 | | -print check_score(score) |
129 | | -``` |
| 102 | +## Tips for Success 🌈 |
| 103 | +- Save your work often! |
| 104 | +- If something doesn't work, check your spelling |
| 105 | +- Have fun experimenting with different numbers and words |
| 106 | +- If you get stuck, try running your program to see what's happening |
130 | 107 |
|
131 | | -Remember: |
132 | | -- Each instruction goes on its own line |
133 | | -- After if or while, put the things you want to do on the next lines |
134 | | -- No need for special symbols like ; or () |
| 108 | +Now you're ready to start coding! Remember, the best way to learn is to try things out and have fun! 🎨 |
135 | 109 |
|
136 | | -Now go ahead and try writing your own programs! 🚀 |
| 110 | +Happy Coding! 🚀 |
0 commit comments