Difference between revisions of "Scilab/C2/Conditional-Branching/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 1: Line 1:
 
{| border=1
 
{| border=1
|| ''Time'''
+
|'''Time'''
|| '''Narration'''
+
|'''Narration'''
  
 
|-
 
|-
  
| 00.01
+
| 00:01
  
 
| | Welcome to the spoken tutorial on Conditional Branching in Scilab.
 
| | Welcome to the spoken tutorial on Conditional Branching in Scilab.
Line 11: Line 11:
 
|-
 
|-
  
| 00.04
+
| 00:04
  
 
| To practice this tutorial open the scilab console window on your computer
 
| To practice this tutorial open the scilab console window on your computer
Line 17: Line 17:
 
|-
 
|-
  
|00.09
+
|00:09
  
 
| | We will discuss two types of Conditional constructs in Scilab that is the  "if-then-else" construct and the "select-case conditional" construct.
 
| | We will discuss two types of Conditional constructs in Scilab that is the  "if-then-else" construct and the "select-case conditional" construct.
Line 23: Line 23:
 
|-
 
|-
  
| 00.19
+
| 00:19
  
 
| | The if statement allows us to execute a group of statements if a given condition is satisfied.
 
| | The if statement allows us to execute a group of statements if a given condition is satisfied.
Line 29: Line 29:
 
|-
 
|-
  
| 00.24
+
| 00:24
  
 
| | Let me give you an example:
 
| | Let me give you an example:
Line 35: Line 35:
 
|-
 
|-
  
| 00.27
+
| 00:27
  
 
| |n is equal 42 if n is equal to equal to 42 then disp the number is 42,  end of if construct.
 
| |n is equal 42 if n is equal to equal to 42 then disp the number is 42,  end of if construct.
Line 41: Line 41:
 
|-
 
|-
  
|00.37
+
|00:37
  
 
| | Here 'is equal to' is the assignment operator, which assigns 42 to the variable n,  
 
| | Here 'is equal to' is the assignment operator, which assigns 42 to the variable n,  
 +
 
|-
 
|-
  
| 00.43
+
| 00:43
  
 
| | And 'is equal to is equal to' is the equality operator, which checks for the equality between the right hand and the left hand side operands.
 
| | And 'is equal to is equal to' is the equality operator, which checks for the equality between the right hand and the left hand side operands.
Line 52: Line 53:
 
|-
 
|-
  
| 00.51
+
| 00:51
  
 
| In this case n and 42 and gives the result in Boolean.
 
| In this case n and 42 and gives the result in Boolean.
Line 58: Line 59:
 
|-
 
|-
  
| 00.57
+
| 00:57
  
 
| | Here the comma after the first line is optional,  
 
| | Here the comma after the first line is optional,  
Line 64: Line 65:
 
|-
 
|-
  
| 01.01
+
| 01:01
  
 
| | Also the ''then'' keyword is optional.
 
| | Also the ''then'' keyword is optional.
Line 70: Line 71:
 
|-
 
|-
  
| 01.04
+
| 01:04
  
 
|| It can be replaced by a comma or a carriage return.
 
|| It can be replaced by a comma or a carriage return.
Line 76: Line 77:
 
|-
 
|-
  
| 01.08
+
| 01:08
  
 
|| The end keyword ends the "if" construct.
 
|| The end keyword ends the "if" construct.
Line 82: Line 83:
 
|-
 
|-
  
| 01.11
+
| 01:11
  
 
|| On executing the script, we see the output as follows.
 
|| On executing the script, we see the output as follows.
Line 88: Line 89:
 
|-
 
|-
  
| 01.20
+
| 01:20
  
 
| | So far we have seen how to execute a set of statements if a condition is true.
 
| | So far we have seen how to execute a set of statements if a condition is true.
Line 94: Line 95:
 
|-
 
|-
  
| 01.26
+
| 01:26
  
 
|| Now we will see how to execute another set of statements if that condition is false or we may wish to check if some other condition is satisfied.
 
|| Now we will see how to execute another set of statements if that condition is false or we may wish to check if some other condition is satisfied.
Line 100: Line 101:
 
|-
 
|-
  
|01.36
+
|01:36
  
 
| | We can do this by using 'else' or 'elseif' keyword respectively.  
 
| | We can do this by using 'else' or 'elseif' keyword respectively.  
Line 106: Line 107:
 
|-
 
|-
  
|01.40
+
|01:40
  
 
| | Here is how we do it
 
| | Here is how we do it
Line 113: Line 114:
 
|-
 
|-
  
| 01.41
+
| 01:41
  
 
|| In this example, 54 is assigned to a variable n and checked for both true condition using 'if' and false condition using 'else' as described:
 
|| In this example, 54 is assigned to a variable n and checked for both true condition using 'if' and false condition using 'else' as described:
Line 119: Line 120:
 
|-
 
|-
  
| 01.55
+
| 01:55
  
 
| | I will cut this, paste in the scilab console hit enter
 
| | I will cut this, paste in the scilab console hit enter
Line 125: Line 126:
 
|-
 
|-
  
| 02.03
+
| 02:03
  
 
| | You see the output.
 
| | You see the output.
Line 131: Line 132:
 
|-
 
|-
  
| 02.05
+
| 02:05
  
 
| | If you notice, the examples shown above are on multiple lines.
 
| | If you notice, the examples shown above are on multiple lines.
Line 137: Line 138:
 
|-
 
|-
  
|02.09
+
|02:09
  
 
|| They can also be written in a single line with proper semicolons and commas.
 
|| They can also be written in a single line with proper semicolons and commas.
Line 143: Line 144:
 
|-
 
|-
  
| 02.19
+
| 02:19
  
 
| | I will cut this and paste in the scilab to execute. Hit enter
 
| | I will cut this and paste in the scilab to execute. Hit enter
Line 149: Line 150:
 
|-
 
|-
  
| 02.27
+
| 02:27
  
 
|| The select statement allows to combine several branches in a clear and simple way.
 
|| The select statement allows to combine several branches in a clear and simple way.
Line 155: Line 156:
 
|-
 
|-
  
|02.31
+
|02:31
  
 
|| Depending on the value of a variable, it allows to perform the statement corresponding to the case keyword.
 
|| Depending on the value of a variable, it allows to perform the statement corresponding to the case keyword.
Line 161: Line 162:
 
|-
 
|-
  
| 02.38
+
| 02:38
  
 
| | There can be as many branches as required.
 
| | There can be as many branches as required.
Line 167: Line 168:
 
|-
 
|-
  
|02.41
+
|02:41
  
 
| Let us try with an example.
 
| Let us try with an example.
Line 173: Line 174:
 
|-
 
|-
  
|02.44
+
|02:44
  
 
| We will assign 100 to a variable 'n' and check the cases 42, 54 and a default case represented by else.  
 
| We will assign 100 to a variable 'n' and check the cases 42, 54 and a default case represented by else.  
Line 179: Line 180:
 
|-
 
|-
  
|02.59
+
|02:59
  
 
| Cut,  paste hit enter
 
| Cut,  paste hit enter
Line 185: Line 186:
 
|-
 
|-
  
| 03.06
+
| 03:06
  
 
| | Here we see the output .
 
| | Here we see the output .
Line 191: Line 192:
 
|-
 
|-
  
| 03.09
+
| 03:09
  
 
|| This brings us to the end of this spoken tutorial on Conditional Branching using Scilab.
 
|| This brings us to the end of this spoken tutorial on Conditional Branching using Scilab.
Line 197: Line 198:
 
|-
 
|-
  
| 03.14
+
| 03:14
  
 
| In this tutorial we have learnt the if - elseif - else statement and the select statement.
 
| In this tutorial we have learnt the if - elseif - else statement and the select statement.
Line 203: Line 204:
 
|-
 
|-
  
| 03.20
+
| 03:20
  
 
| | There are many other functions in Scilab which will be covered in other spoken tutorials.
 
| | There are many other functions in Scilab which will be covered in other spoken tutorials.
Line 209: Line 210:
 
|-
 
|-
  
|03.25
+
|03:25
  
 
|| Keep watching the Scilab links.
 
|| Keep watching the Scilab links.
Line 215: Line 216:
 
|-
 
|-
  
| 03.27
+
| 03:27
  
 
|| Spoken Tutorials are part of the Talk to a Teacher project, supported by the National Mission on Education through ICT.
 
|| Spoken Tutorials are part of the Talk to a Teacher project, supported by the National Mission on Education through ICT.
Line 221: Line 222:
 
|-
 
|-
  
| 03.35
+
| 03:35
  
 
| | More information on the same is available on the following link  
 
| | More information on the same is available on the following link  
Line 227: Line 228:
 
|-
 
|-
  
| 03.38
+
| 03:38
  
 
| |Thanks for joining good bye.
 
| |Thanks for joining good bye.
  
 
|}
 
|}

Revision as of 16:42, 10 July 2014

Time Narration
00:01 Welcome to the spoken tutorial on Conditional Branching in Scilab.
00:04 To practice this tutorial open the scilab console window on your computer
00:09 We will discuss two types of Conditional constructs in Scilab that is the "if-then-else" construct and the "select-case conditional" construct.
00:19 The if statement allows us to execute a group of statements if a given condition is satisfied.
00:24 Let me give you an example:
00:27 n is equal 42 if n is equal to equal to 42 then disp the number is 42, end of if construct.
00:37 Here 'is equal to' is the assignment operator, which assigns 42 to the variable n,
00:43 And 'is equal to is equal to' is the equality operator, which checks for the equality between the right hand and the left hand side operands.
00:51 In this case n and 42 and gives the result in Boolean.
00:57 Here the comma after the first line is optional,
01:01 Also the then keyword is optional.
01:04 It can be replaced by a comma or a carriage return.
01:08 The end keyword ends the "if" construct.
01:11 On executing the script, we see the output as follows.
01:20 So far we have seen how to execute a set of statements if a condition is true.
01:26 Now we will see how to execute another set of statements if that condition is false or we may wish to check if some other condition is satisfied.
01:36 We can do this by using 'else' or 'elseif' keyword respectively.
01:40 Here is how we do it


01:41 In this example, 54 is assigned to a variable n and checked for both true condition using 'if' and false condition using 'else' as described:
01:55 I will cut this, paste in the scilab console hit enter
02:03 You see the output.
02:05 If you notice, the examples shown above are on multiple lines.
02:09 They can also be written in a single line with proper semicolons and commas.
02:19 I will cut this and paste in the scilab to execute. Hit enter
02:27 The select statement allows to combine several branches in a clear and simple way.
02:31 Depending on the value of a variable, it allows to perform the statement corresponding to the case keyword.
02:38 There can be as many branches as required.
02:41 Let us try with an example.
02:44 We will assign 100 to a variable 'n' and check the cases 42, 54 and a default case represented by else.
02:59 Cut, paste hit enter
03:06 Here we see the output .
03:09 This brings us to the end of this spoken tutorial on Conditional Branching using Scilab.
03:14 In this tutorial we have learnt the if - elseif - else statement and the select statement.
03:20 There are many other functions in Scilab which will be covered in other spoken tutorials.
03:25 Keep watching the Scilab links.
03:27 Spoken Tutorials are part of the Talk to a Teacher project, supported by the National Mission on Education through ICT.
03:35 More information on the same is available on the following link
03:38 Thanks for joining good bye.

Contributors and Content Editors

Gaurav, Kavita salve, PoojaMoolya, Sandhya.np14, Sneha