SlideShare a Scribd company logo
Ring Documentation, Release 1.5.3
14.11 The Browser Menu
From this menu we can quickly open common links in the browser
14.12 The Tools Menu
From this window we can run the Form Designer in separate window
Also we can run the REPL (Read-Eval-Print-Loop) application
14.13 The Help Menu
From this menu we can get the help files (CHM & PDF)
14.11. The Browser Menu 145
CHAPTER
FIFTEEN
USING OTHER CODE EDITORS
In the Ring/Editor folder you will find extensions for the next editors
• Notepad++
• Geany
• Atom
• Sublime Text 2
• Visual Studio IDE
• Emacs
15.1 Using Notepad++
Folder : ring/editor/notepad_plus_plus
• Open Notepad++
• Open the “Language” menu
• Select “Define your language...”
• Click “Import...”
• select Ring.xml
• Select “OK” on the “Import successful” dialog and close the “User Defined Language” dialog/panel
• You may need to restart notepad++
146
Ring Documentation, Release 1.5.3
15.2 Using Geany
Folder : ring/editor/geany
• Run Geany editor
• Click on “Tools -> configuration files -> filetypes_extensions.conf” menu
• Add this line “Ring=*.ring;” without quotes after [Extensions]
• In unbuntu copy file “filetypes.Ring.conf” to folder “/home/USERNAME/filetypes.Ring.conf”
• You can run your files by pressing F5 button
15.2. Using Geany 147
Ring Documentation, Release 1.5.3
15.3 Using Atom
Folder : ring/editor/atom
Just Copy the folder atom-language-ring to the next path
"C:Users{UserName}.atomPackages"
15.3. Using Atom 148
Ring Documentation, Release 1.5.3
15.4 Using Sublime Text 2
Folder : ring/editor/sublime text 2
In the folder Sublime_Text_2 you will find the next three files
1 - ring.json-tmlanguage
2 - ring.sublime-build
3 - ring.tmlanguage
Just Copy the files to the next path
"C:Users{UserName}AppDataRoamingSublime Text 2PackagesUser"
The file ring.sublime-build includes the next line
"cmd": ["B:ringbinring.exe","$file"],
You can modify it according to the ring.exe path in your machine
15.4. Using Sublime Text 2 149
Ring Documentation, Release 1.5.3
15.5 Using Visual Studio IDE
Folder : ring/editor/visualstudio
Check the ReadMe file for installation instructions.
15.5. Using Visual Studio IDE 150
Ring Documentation, Release 1.5.3
15.6 Using Emacs Editor
Folder : ring/editor/emacs
Check the ReadMe file for installation instructions.
Screen Shot:
15.6. Using Emacs Editor 151
CHAPTER
SIXTEEN
VARIABLES
To create a new variable, you just need to determine the variable name & value. The value will determine the variable
type and you can change the value to switch between the types using the same variable name.
Syntax:
<Variable Name> = <Value>
Tip: The operator ‘=’ is used here as an Assignment operator and the same operator can be used in conditions, but
for testing equality of expressions.
Note: The Variable will contains the real value (not a reference). This means that once you change the variable value,
the old value will be removed from memory (even if the variable contains a list or object).
16.1 Dynamic Typing
Ring is a dynamic programming language that uses Dynamic Typing.
x = "Hello" # x is a string
see x + nl
x = 5 # x is a number (int)
see x + nl
x = 1.2 # x is a number (double)
see x + nl
x = [1,2,3,4] # x is a list
see x # print list items
x = date() # x is a string contains date
see x + nl
x = time() # x is a string contains time
see x + nl
x = true # x is a number (logical value = 1)
see x + nl
x = false # x is a number (logical value = 0)
see x + nl
16.2 Deep Copy
We can use the assignment operator ‘=’ to copy variables. We can do that to copy values like strings & numbers. Also,
we can copy complete lists & objects. The assignment operator will do a complete duplication for us. This operation
called Deep Copy
152
Ring Documentation, Release 1.5.3
list = [1,2,3,"four","five"]
list2 = list
list = []
See list # print the first list - no items to print
See "********" + nl
See list2 # print the second list - contains 5 items
16.3 Weakly Typed
Ring is a weakly typed language, this means that the language can automatically convert between data types (like
string & numbers) when that conversion make sense.
Rules:
<NUMBER> + <STRING> --> <NUMBER>
<STRING> + <NUMBER> --> <STRING>
Note: The same operator ‘+’ can be used as an arithmetic operator or for string concatenation.
Example:
x = 10 # x is a number
y = "20" # y is a string
sum = x + y # sum is a number (y will be converted to a number)
Msg = "Sum = " + sum # Msg is a string (sum will be converted to a string)
see Msg + nl
16.3. Weakly Typed 153
CHAPTER
SEVENTEEN
OPERATORS
In this chapter we will introduce the operators provided by the Ring programming langauge.
17.1 Arithmetic Operators
The next table presents all of the arithmetic operators provided by the Ring language. Assume variable X=50 and
variable Y=10 then:
Operator Description Example Result
+ Add x+y 60
- Subtract x-y 40
* Multiplies x*y 500
/ Divide x/y 5
% Modulus x%y 0
++ Increment x++ 51
- - Decrement x- - 49
17.2 Relational Operators
The next table presents all of the relational operators provided by the Ring language. Assume variable X=50 and
variable Y=10 then:
Operator Description Example Result
= Equal x = y False
!= Not Equal x != y True
> Greater than x > y True
< Less than x < y False
>= Greater or Equal x >= y True
<= Less than or Equal x <= y False
17.3 Logical Operators
The next table presents all of the logical operators provided by the Ring language. Assume variable X=True and
variable Y=False then:
Operator Description Example Result
and Logical AND x and y False
or Logical OR x or y True
not Logical Not not x False
154

More Related Content

What's hot (18)

PDF
The Ring programming language version 1.2 book - Part 11 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 12 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 10 of 84
Mahmoud Samir Fayed
 
TXT
Program to sort array using insertion sort
Swarup Boro
 
PDF
The Ring programming language version 1.5.3 book - Part 20 of 184
Mahmoud Samir Fayed
 
DOCX
Function and class templates
Ankit Gupta
 
PPTX
Print input-presentation
Martin McBride
 
PPTX
Intro to C++
Ahmed Farag
 
PDF
please sir i want to comments of every code what i do in eachline . in this w...
hwbloom27
 
ODP
2.2 higher order-functions
futurespective
 
DOCX
Assignement of programming & problem solving ass.(3)
Syed Umair
 
PPSX
Nested loops
Adnan Ferdous Ahmed
 
PDF
10 template code program
Bint EL-maghrabi
 
PDF
Nesting of for loops using C++
prashant_sainii
 
PPTX
Json to xml esb transformation
Domenico Schiavone
 
DOCX
Mouse programming in c
gkgaur1987
 
PPTX
preventing sqli and xss by ravi rajput in owasp meet ahmedabad
Ravi Rajput
 
PDF
Slink into Elixir
LINE Corporation
 
The Ring programming language version 1.2 book - Part 11 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 12 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 10 of 84
Mahmoud Samir Fayed
 
Program to sort array using insertion sort
Swarup Boro
 
The Ring programming language version 1.5.3 book - Part 20 of 184
Mahmoud Samir Fayed
 
Function and class templates
Ankit Gupta
 
Print input-presentation
Martin McBride
 
Intro to C++
Ahmed Farag
 
please sir i want to comments of every code what i do in eachline . in this w...
hwbloom27
 
2.2 higher order-functions
futurespective
 
Assignement of programming & problem solving ass.(3)
Syed Umair
 
Nested loops
Adnan Ferdous Ahmed
 
10 template code program
Bint EL-maghrabi
 
Nesting of for loops using C++
prashant_sainii
 
Json to xml esb transformation
Domenico Schiavone
 
Mouse programming in c
gkgaur1987
 
preventing sqli and xss by ravi rajput in owasp meet ahmedabad
Ravi Rajput
 
Slink into Elixir
LINE Corporation
 

Similar to The Ring programming language version 1.5.3 book - Part 18 of 184 (20)

PDF
The Ring programming language version 1.8 book - Part 23 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 17 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 18 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 178 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 174 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 11 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 17 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 93 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 7 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 7 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 19 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 8 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 22 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 18 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 11 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 11 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 189 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 194 of 194
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 5 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 23 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 17 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 18 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 178 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 174 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 11 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 17 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 93 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 7 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 7 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 19 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 8 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 22 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 18 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 11 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 11 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 189 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 194 of 194
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 5 of 180
Mahmoud Samir Fayed
 
Ad

More from Mahmoud Samir Fayed (20)

PDF
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 191 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 191 of 212
Mahmoud Samir Fayed
 
Ad

Recently uploaded (20)

PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 

The Ring programming language version 1.5.3 book - Part 18 of 184

  • 1. Ring Documentation, Release 1.5.3 14.11 The Browser Menu From this menu we can quickly open common links in the browser 14.12 The Tools Menu From this window we can run the Form Designer in separate window Also we can run the REPL (Read-Eval-Print-Loop) application 14.13 The Help Menu From this menu we can get the help files (CHM & PDF) 14.11. The Browser Menu 145
  • 2. CHAPTER FIFTEEN USING OTHER CODE EDITORS In the Ring/Editor folder you will find extensions for the next editors • Notepad++ • Geany • Atom • Sublime Text 2 • Visual Studio IDE • Emacs 15.1 Using Notepad++ Folder : ring/editor/notepad_plus_plus • Open Notepad++ • Open the “Language” menu • Select “Define your language...” • Click “Import...” • select Ring.xml • Select “OK” on the “Import successful” dialog and close the “User Defined Language” dialog/panel • You may need to restart notepad++ 146
  • 3. Ring Documentation, Release 1.5.3 15.2 Using Geany Folder : ring/editor/geany • Run Geany editor • Click on “Tools -> configuration files -> filetypes_extensions.conf” menu • Add this line “Ring=*.ring;” without quotes after [Extensions] • In unbuntu copy file “filetypes.Ring.conf” to folder “/home/USERNAME/filetypes.Ring.conf” • You can run your files by pressing F5 button 15.2. Using Geany 147
  • 4. Ring Documentation, Release 1.5.3 15.3 Using Atom Folder : ring/editor/atom Just Copy the folder atom-language-ring to the next path "C:Users{UserName}.atomPackages" 15.3. Using Atom 148
  • 5. Ring Documentation, Release 1.5.3 15.4 Using Sublime Text 2 Folder : ring/editor/sublime text 2 In the folder Sublime_Text_2 you will find the next three files 1 - ring.json-tmlanguage 2 - ring.sublime-build 3 - ring.tmlanguage Just Copy the files to the next path "C:Users{UserName}AppDataRoamingSublime Text 2PackagesUser" The file ring.sublime-build includes the next line "cmd": ["B:ringbinring.exe","$file"], You can modify it according to the ring.exe path in your machine 15.4. Using Sublime Text 2 149
  • 6. Ring Documentation, Release 1.5.3 15.5 Using Visual Studio IDE Folder : ring/editor/visualstudio Check the ReadMe file for installation instructions. 15.5. Using Visual Studio IDE 150
  • 7. Ring Documentation, Release 1.5.3 15.6 Using Emacs Editor Folder : ring/editor/emacs Check the ReadMe file for installation instructions. Screen Shot: 15.6. Using Emacs Editor 151
  • 8. CHAPTER SIXTEEN VARIABLES To create a new variable, you just need to determine the variable name & value. The value will determine the variable type and you can change the value to switch between the types using the same variable name. Syntax: <Variable Name> = <Value> Tip: The operator ‘=’ is used here as an Assignment operator and the same operator can be used in conditions, but for testing equality of expressions. Note: The Variable will contains the real value (not a reference). This means that once you change the variable value, the old value will be removed from memory (even if the variable contains a list or object). 16.1 Dynamic Typing Ring is a dynamic programming language that uses Dynamic Typing. x = "Hello" # x is a string see x + nl x = 5 # x is a number (int) see x + nl x = 1.2 # x is a number (double) see x + nl x = [1,2,3,4] # x is a list see x # print list items x = date() # x is a string contains date see x + nl x = time() # x is a string contains time see x + nl x = true # x is a number (logical value = 1) see x + nl x = false # x is a number (logical value = 0) see x + nl 16.2 Deep Copy We can use the assignment operator ‘=’ to copy variables. We can do that to copy values like strings & numbers. Also, we can copy complete lists & objects. The assignment operator will do a complete duplication for us. This operation called Deep Copy 152
  • 9. Ring Documentation, Release 1.5.3 list = [1,2,3,"four","five"] list2 = list list = [] See list # print the first list - no items to print See "********" + nl See list2 # print the second list - contains 5 items 16.3 Weakly Typed Ring is a weakly typed language, this means that the language can automatically convert between data types (like string & numbers) when that conversion make sense. Rules: <NUMBER> + <STRING> --> <NUMBER> <STRING> + <NUMBER> --> <STRING> Note: The same operator ‘+’ can be used as an arithmetic operator or for string concatenation. Example: x = 10 # x is a number y = "20" # y is a string sum = x + y # sum is a number (y will be converted to a number) Msg = "Sum = " + sum # Msg is a string (sum will be converted to a string) see Msg + nl 16.3. Weakly Typed 153
  • 10. CHAPTER SEVENTEEN OPERATORS In this chapter we will introduce the operators provided by the Ring programming langauge. 17.1 Arithmetic Operators The next table presents all of the arithmetic operators provided by the Ring language. Assume variable X=50 and variable Y=10 then: Operator Description Example Result + Add x+y 60 - Subtract x-y 40 * Multiplies x*y 500 / Divide x/y 5 % Modulus x%y 0 ++ Increment x++ 51 - - Decrement x- - 49 17.2 Relational Operators The next table presents all of the relational operators provided by the Ring language. Assume variable X=50 and variable Y=10 then: Operator Description Example Result = Equal x = y False != Not Equal x != y True > Greater than x > y True < Less than x < y False >= Greater or Equal x >= y True <= Less than or Equal x <= y False 17.3 Logical Operators The next table presents all of the logical operators provided by the Ring language. Assume variable X=True and variable Y=False then: Operator Description Example Result and Logical AND x and y False or Logical OR x or y True not Logical Not not x False 154