If Statement
The basic conditional
Quick Recap
In the previous page, we learnt about the ranged for loop syntax of Cylvre and how it makes it unique and easy to learn, now we come to the topic of conditional statements, which makes a language (along with loops) Turing complete.
This is where Cylvre starts being slightly different. Built for simplicity, Cylvre has revamped the structure of the entire if statement, making it extremely easy to use and extremely concise too. Given below is a basic program in Cylvre that checks the divisibility of a number by 5.
The if statement starts with the question, that is, the condition. The condition in the above program is x = 10. The if statement is then initialized by the question mark '?', just like the way we ask questions. If the condition is true, which it is in this case, the statement is executed or if the condition is false, the statement is skipped.
Last updated
Was this helpful?