Differences

This shows you the differences between two versions of the page.

Link to this comparison view

gnucap:user:if_else_statement [2015/12/11 15:39] (current)
Line 1: Line 1:
 +====if statement====
 +
 +Purpose: This statement is used to make one-time decisions,i.e,to execute some part of the script and ignore other.
 +
 +Status: Done
 +
 +Syntax:
 + 
 +   if condition      
 +    ...  
 +   elif another_condition 
 +    ...
 +   end
 +
 +Following examples illustrates the use of if statements in Gnucap.
 +
 +Example 1:
 +
 +  param a=1 
 +  if a
 +    echo if
 +  else
 +    echo else
 +  end
 +
 +Output:
 +       gnucap> if
 +
 +Example 2:
 +
 +   param a=0
 +   if a
 +     echo if
 +   elif !a
 +     echo elif
 +   end
 +  
 +Output: 
 +      gnucap>elif
 +   
 +This command also supports the nesting of if statements.
 +
 +Example 3:
 +    param a=1
 +    param b=1
 +    if a
 +       echo if
 +       if !b
 +       echo nested if
 +       else
 +       echo nested else
 +       end
 +     else
 +       echo else
 +     end
 +     
 +Output: 
 +          gnucap>if
 +                 nested else
 +
 +The development of this plugin is currently in progress to make it compatible with other loop statements. 
  
gnucap/user/if_else_statement.txt · Last modified: 2015/12/11 15:39 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki