Keywords

Let's delve deeper into each of the keywords you've listed and how they would function within your X3 language:

  1. var: This keyword is used to declare variables. Variables are used to store data values that can be manipulated and changed throughout the program.

  2. and: The "and" keyword is a logical operator used to combine two conditions. It evaluates to true only if both conditions are true.

  3. 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.

  4. 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.

  5. if: The "if" keyword is used to execute a block of code only if a specified condition is true.

  6. 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.

  7. 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.

  8. for: The "for" keyword is used to create a loop that iterates over a sequence of values.

  9. to: The "to" keyword is used in conjunction with the "for" loop to specify the range of values to iterate over.

  10. step: The "step" keyword is used in conjunction with the "for" loop to specify the increment or decrement value for each iteration.

  11. while: The "while" keyword is used to create a loop that continues to execute as long as a specified condition is true.

  12. fun: The "fun" keyword is used to define a function. Functions are blocks of reusable code that perform a specific task.

  13. 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.

  14. 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.

  15. return: The "return" keyword is used to specify the value that a function should return when it is called.

  16. continue: The "continue" keyword is used inside loops to skip the current iteration and proceed to the next iteration.

  17. 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