• [^] # Re: marrant, ton truc

    Posté par (site web personnel) . En réponse au message Algo de recherche arborescente en largeur. Évalué à 2.

    Oui, effectivement, la syntaxe de if est un peu déroutante

    if condition then instruction1; instruction2; end
    quand il n'y a pas de "sinon" et

    if condition then instruction1; instruction2;
    else instruction3; instruction4; end
    quand il y en a un.
    (En fait le else ferme le bloc d'instruction précédent).

    Sinon, scilab est orienté liste, donc si tu fais
    a=[2];
    a=[ 1 a];
    a=[a -a 3];

    tu récupères a=[1 2 -1 -2 3]