1. Comments

Ymir offers different types of comments.

  • // A line of comment that stop at the end of the line

  • /* Multi-line comment that stops at the final delimiter */

def main () 
    throws &AssertError // Not what's important for the moment
{
    // This is an example of comment

    /* 
     * This is another example of comment
     * Where, the stars are optionnal
     */

    /*
    And this is the proof
    */

    // None of the comment lines have an influence on the compilation

    let x = 1 + /* 2 + */  3;
    assert (x == 4); 
}

In the above pogram, calling assert will throw an exception if the test is false. Errors are presented in the Error Handling chapter. For the moment, we can consider that the exception simply stops the program when the test fails.

We will see in the Documentation chapter, that comments are very usefull, to generate documentations.

results matching ""

    No results matching ""