Keywords
Let's delve deeper into each of the keywords you've listed and how they would function within your X3 language:
var: This keyword is used to declare variables. Variables are used to store data values that can be manipulated and changed throughout the program.
and: The "and" keyword is a logical operator used to combine two conditions. It evaluates to true only if both conditions are true.
or: The "or" keyword is another logical operator used to combine two conditions. It evaluates to true if at least one of the conditions is true.
not: The "not" keyword is a unary logical operator used to negate the value of a condition. It converts true to false and false to true.
if: The "if" keyword is used to execute a block of code only if a specified condition is true.
elif: The "elif" keyword is short for "else if". It is used to specify a new condition to test if the previous conditions in an "if" statement are false.
else: The "else" keyword is used in conjunction with an "if" statement to specify a block of code to be executed if the condition is false.
for: The "for" keyword is used to create a loop that iterates over a sequence of values.
to: The "to" keyword is used in conjunction with the "for" loop to specify the range of values to iterate over.
step: The "step" keyword is used in conjunction with the "for" loop to specify the increment or decrement value for each iteration.
while: The "while" keyword is used to create a loop that continues to execute as long as a specified condition is true.
fun: The "fun" keyword is used to define a function. Functions are blocks of reusable code that perform a specific task.
then: The "then" keyword is used in conditional statements (such as "if" or "for") to indicate the beginning of the code block to be executed if the condition is true.
end: The "end" keyword is used to mark the end of a block of code, such as the end of a function definition or the end of a loop.
return: The "return" keyword is used to specify the value that a function should return when it is called.
continue: The "continue" keyword is used inside loops to skip the current iteration and proceed to the next iteration.
break: The "break" keyword is used inside loops to exit the loop prematurely.
These keywords form the backbone of the syntax and control flow in your X3 programming language, allowing users to write structured and functional code.
Last updated