Ruby/C2/Arithmetic-and-Relational-Operators/Gujarati

From Script | Spoken-Tutorial
Revision as of 22:34, 22 July 2014 by Jyotisolanki (Talk | contribs)

Jump to: navigation, search


Time Narration
00:01 Ruby માં Arithmetic & Relational Operators પરનાં સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે.
00:06 આ ટ્યુટોરીયલમાં આપણે આપેલ વિશે શીખીશું
00:08 Arithmetic Operators (એર્થમેટીક ઓપરેટર્સ)
00:10 Operator Precedence (ઓપરેટર પ્રેસીડન્સ)
00:12 Relational Operators (રીલેશનલ ઓપરેટર્સ)
00:14 અહીં આપણે ઉબુન્ટુ લીનક્સ આવૃત્તિ 12.04 રૂબી 1.9.3 વાપરી રહ્યા છીએ
00:23 આ ટ્યુટોરીયલનાં અનુસરણ માટે તમને લીનક્સમાં ટર્મિનલ તથા ટેક્સ્ટ એડીટર કેવી રીતે વાપરવું તે વિશે જાણકારી હોવી જરૂરી છે.
00:28 તમે irb થી પણ પરિચિત હોવા જોઈએ
00:31 જો નથી, તો સંદર્ભિત ટ્યુટોરીયલો માટે, કૃપા કરી અમારી વેબસાઈટનો સંદર્ભ લો
00:34 હવે ચાલો એર્થમેટીક ઓપરેટરો વિશે શીખીએ.
00:38 રૂબીમાં આપેલ એર્થમેટીક ઓપરેટરો છે.
00:42 +Addition: (+ એડીશન) ઉ.દા. a+b.
00:45 - Subtraction: (- સબટ્રેક્શન) ઉ.દા. a-b.
00:48 / Division: (/ ડીવીઝન) ઉ.દા. a/b.
00:51 * Multiplication: (* મલ્ટીપ્લીકેશન) ઉ.દા. a*b.
00:55 % Modulus: (% મોડ્યુલસ) ઉ.દા. a%b.
00:59 ** Exponent: ઉ.દા. a**b
01:04 ચાલો irb વાપરીને આ એર્થમેટીક ઓપરેટરોને ચકાસીશું.
01:08 Ctrl, Alt અને T કી એક સાથે દાબીને ટર્મિનલ વિન્ડો ખોલો.
01:14 આપણી સ્ક્રીન પર એક ટર્મિનલ વિન્ડો દ્રશ્યમાન થાય છે.
01:17 interactive Ruby (ઈંટરેક્ટીવ રૂબી) ને શરુ કરવા માટે ટાઈપ કરો irb અને Enter (એન્ટર) દબાવો.
01:21 10 plus 20 ટાઈપ કરો અને Enter દબાવો.
01:25 એડીશન ઓપરેશન થાય છે અને પરિણામ સ્વરૂપે 30 દ્રશ્યમાન થાય છે.
01:31 આજ પ્રમાણે સબટ્રેક્શન અને મલ્ટીપ્લીકેશન ઓપરેશનો ભજવી શકાય છે.
01:35 ચાલો ડીવીઝન ઓપરેટર પ્રયાસ કરીએ.
01:38 10 slash 4 ટાઈપ કરો
01:40 અને Enter દબાવો.
01:42 અહીં તમે જોઈ શકો છો, કે પરિણામ નજીકનાં પૂર્ણ ક્રમાંકમાં વિચ્છીત થાય છે જે કે ૨ છે.
01:47 વધુ ચોક્કસ જવાબ મેળવવા માટે, આપણને એક ક્રમાંક float ફ્લોટ તરીકે વ્યક્ત કરવાની જરૂર છે.
01:52 10.0 slash 4 ટાઇપ કરો
01:56 અને Enter દબાવો.
01:58 આપણને પરિણામ 2.5 તરીકે મળે છે.
02:01 ચાલો હવે મોડ્યુલસ ઓપરેટર પ્રયાસ કરીએ.
02:05 મોડ્યુલસ ઓપરેટર શેષને આઉટપુટ તરીકે પાછું આપે છે.
02:09 ટાઈપ કરો 12 percentage sign 5 અને Enter દબાવો.
02:15 અહીં 12 , એ 5 દ્વારા વિભાજીત થાય છે અને શેષ 2 ને પાછું અપાવાય છે.
02:21 હવે ચાલો exponent (એક્સપોનંટ) ઓપરેટર પ્રયાસ કરીએ
02.24 ટાઈપ કરો 2 પછી બે વાર અસ્ટેરિસ્ક ચિન્હ અને ત્યારબાદ 5 અને Enter દબાવો.
02:32 આનો અર્થ એ છે કે 2 ને ઘાતાંક 5 છે.
02:36 તેથી આપણને આઉટપુટ 32 મળે છે.
02:39 આગળ, ચાલો ઓપરેટર પ્રેસીડન્સ વિશે શીખીએ.
02:44 જ્યારે ગાણિતિક પદાવલીમાં અનેક ઓપરેશનો થાય છે ત્યારે,
02:47 દરેક ભાગનું મૂલ્યાંકન
02:50 અને ઉકેલ એક પૂર્વનિર્ધારિત અનુક્રમનાં આધારે કરવામાં આવે છે જેને ઓપરેટર પ્રેસીડન્સ કહેવાય છે.
02:56 આનો અર્થ એ છે કે ઉચ્ચ પ્રાધાન્ય ધરાવતા ઓપરેટરો સૌપ્રથમ એક્ઝીક્યુટ થશે.
03:01 ત્યાર પછીથી પ્રાધાન્ય ક્રમનાં આધારે આગળ આવતા ઓપરેટરો રહેશે અને એજ પ્રમાણે આગળ.
03:07 આ સ્લાઇડ ઉચ્ચ પ્રેસીડન્સથી નિમ્ન પ્રેસીડન્સ ધરાવતા તમામ ઓપરેટરોની યાદી આપે છે.


03:13 ઉદાહરણ તરીકે 3 + 4 * 5 23 આવે છે 35 નહી.
03:23 addition operator (+) (એડીશનલ ઓપરેટર) ની અપેક્ષા multiplication operator (*) (મલ્ટીપ્લીકેશન ઓપરેટર) ને ઉચ્ચ પ્રાધાન્ય પ્રેસિડેન્સ આપવામા આવે છે.
03:29 અને આમ પ્રથમ મૂલ્યાંકન કરવામાં આવશે.


03:32 એટલા માટે પાચ વખત ચાર,વીસ આવે છે,અને પછી ત્રણ 20 મા ઉમેરાય છે.તો આઉટપુટ 23 મળે છે.
03:42 ચાલો ઓપરેટર્સ પ્રેસિડેન્સ પર આધારિત થોડા ઉદાહરણ જોઈએ.
03:47 ચાલો ટર્મિનલ પર પાછા જાઓ.
03:50 irb console ને સાફ કરવા માટે Crtl અને Lકીઓ ને એક સાથે દાબો.
03:56 હવે ટાઈપ કરો 7 minus 2 multiply by 3
04:03 અને Enter દબાઓ.
04:05 આપણને જબાબ 1 મળે છે.
04:08 અહી minus સાઈનકી અપેક્ષા asterisk સિમ્બોલ ઉચ્ચ પ્રાધાન્ય રાખે છે.


04:13 એટલા માટે multiplication opertion પહેલા કરવામા આવે છે અને પછી subtraction.
04:20 ચાલો આપણે અન્ય ઉદાહરણ જોઈએ.
04:22 કૌંસ અંદર ટાઇપ કરો 10 plus 2 slash 4
04:29 અને Enter દબાઓ.
04:30 આપણને જવાબ 3 મળે છે.
04:33 આ કિસ્સામાંdivision (slash) ના અપેક્ષામાં () કૌંસના ઉચ્ચ પ્રાધાન્ય છે.
04:39 So the operation inside the bracket that is addition is performed first.
04:44 Then division is performed.
04:47 Now, let us learn about Relational Operators.
04:51 Let's switch back to slides.
04:54 Relational operators are also known as comparison operators.
04:59 Expressions using relational operators return boolean values.
05:04 Relation Operators in Ruby are
05:07 == Equals to Eg. a==b
05:14 dot eql question mark Eg. a.eql?b
05:21 != Not equals to Eg. a exclamation equal b
05:28 Less than Eg. a < b
05:32 Greater than Eg. a > b
05:37 <= Lesser than or equal to Eg.a less than arrow equal b
05:44 >= Greater than or equal to Eg.a greater than arrow equal b
05:49 <=> Combined comparison Eg.a less than arrow equal greater than arrow b
05:56 Now let us try some of these operators.
06:00 Go to the terminal.
06:02 Press ctrl, L keys simultaneously to clear the irb console.
06:09 Lets us try equals to operator.
06:11 So type 10 equals equals 10


06:16 and Press Enter
06:17 We get the output as true.
06:20 .eql? opeartor is same as equals to operator.
06:24 Lets try it out
06:25 Now type 10 .eql?10 and Press Enter
06:33 We get the output as true
06:35 Now lets try not equal to operator.
06:39 Type 10 not equal 10
06:44 And Press Enter
06:46 We get the output as false.
06:48 This is because the two numbers are equal.


06:51 Clear the irb console by pressing Ctrl, L simultaneously.
06:56 Let us now try less than operator.
07:00 Type 10 less than 5 and Press Enter


07:05 Here if first operand is less than second then it will return true
07:10 otherwise it will return false


07:14 We get the output as false because 10 is not less than 5
07:19 We will now try greater than operator
07:22 Type 5 greater than 2
07:26 Here if first operand is greater than second then it will return true
07:31 otherwise it will return false
07:34 Press Enter
07:36 In this case, we get the output as True because 5 is indeed greater than 2
07:42 Clear the irb console by pressing Ctrl, L simultaneously
07:47 We will now try the less than equal to operator
07:51 Type 12 less than equal 12


07:56 and Press Enter


07:59 Here if first operand is less than or equal to second then it returns true
08:04 otherwise it returns false
08:07 We get the output as True because 12 is equal to 12
08:11 You can try out the greater than or equal to operator likewise.
08:15 Now let's try the combined comparision operator.
08:19 The combined comparision operator
08:21 Returns 0 if first operand equals second


08:24 Returns 1 if first operand is greater than the second and


08:29 Returns -1 if first operand is less than the second operand


08:34 Let's see how it works with an example
08:36 Type 3 less than equals greater than 3
08:41 And Press Enter


08:43 We get the output as 0
08:45 because both the operands are equal i.e. both are three
08:50 Now, let's change one of the operands to 4
08:53 Type 4 less than equals greater than 3


08:58 And Press Enter
08:59 We get the output as 1
09:01 Since 4 is greater than 3


09:04 Now, let's change this example again
09:07 Type 4 less than equals greater than 7


09:11 And Press Enter
09:13 We get the output as -1
09:14 Since 4 is less than 7


09:17 As an assignment
09:19 Solve the following examples using irb and check the output
09:24 10 + bracket 2 astreisk 5 bracket 8 slash 2
09:32 4 astreisk 5 slash 2 plus 7
09:37 Also, try arithmetic operators using methods
09:42 This brings us to the end of this Spoken Tutorial.


09:45 Let's summarize


09:47 In this tutorial we have learnt about
09:49 Arithmetic Operators plus minus astreisk slash standing for addition, subtraction, multiplication, division.
09:59 Operator Precedence
10:01 Relational Operators
10:04 using many examples
10:06 Watch the video available at the following link.
10:10 It summarises the Spoken Tutorial project.
10:14 If you do not have good bandwidth, you can download and watch it.
10:18 The Spoken Tutorial Project Team :
10:20 Conducts workshops using spoken tutorials
10:23 Gives certificates to those who pass an online test
10:26 For more details, please write to contact@spoken-tutorial.org
10:32 Spoken Tutorial Project is a part of the Talk to a Teacher project.
10:36 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
10:43 More information on this Mission is available at spoken hyphen tutorial dot org slash NMEICT hyphen Intro
10:51 This script has been contributed by the spoken tutorial team IIT Bombay
10:57 And this is Anjana Nair signing off Thank you


Contributors and Content Editors

Jyotisolanki, PoojaMoolya