2012年11月9日 星期五

Scilab fundamentals 8 - The if statement

    It supposes that most persons ever heard that– If you really love me, you are willing to do everything for me. It’s very romantic, if this statement holds. In other words, if the statement holds, I will do everything for you, or I won’t do anything for you. Now, we reorganize the preceding description as the following statement.



    Therefore, we can construct a if statement based on the above structure.

 
    Based on the above example, the if-than-else expression is extended to if-than-elseif-else expression which contains more actions.
 
 
    The if statement is a fundamental statement in programming. Using if statement, we can define a criterion and the relevant actions, or check a specified condition is achieved or not. For example, we define a convergent criterion for iterations.

沒有留言:

張貼留言