Escolar Documentos
Profissional Documentos
Cultura Documentos
Install Libraries
cd ring/src
./installdep.sh
SEVEN
HOW TO CONTRIBUTE?
Throughout the creation of this project, Ring relied heavily on contributions from experts along with college students.
Their input was invaluable, and we want to take a moment to thank them and recognize them for all of their hard work.
Ring Team: http://ring-lang.sf.net/team.html
7.2 Documentation
You can modify anything in the documentation, by updating the text files (*.txt) in this folder : https://github.com/ring-
lang/ring/tree/master/docs/source
The documentation is created using Sphinx : http://www.sphinx-doc.org/en/stable/
7.3 Testing
42
Ring Documentation, Release 1.2
7.4 Samples
7.5 Applications
You can share your ideas, suggestions and questions in this group
https://groups.google.com/forum/#!forum/ring-lang
7.4. Samples 43
CHAPTER
EIGHT
The next program prints the Hello World message on the screen (std-out).
see "Hello World"
to run the program, save the code in a file, for example : hello.ring then from the command line or terminal, run it
using the ring interpreter
ring hello.ring
Since the Ring language is not case-sensitive, the same program can be written in different styles
Tip: Its better to select one style and use it in all of the program source code
Using Ring we can write multi-line literal, see the next example
See "
Hello
Welcome to the Ring programming language
How are you?
"
Also you can use the nl constant to insert new line and you can use the + operator to concatenate strings
44
Ring Documentation, Release 1.2
Note: nl value means a new line and the actual codes that represent a newline is different between operating systems
You can get the input from the user using the give command
See "What is your name? "
Give cName
See "Hello " + cName
You dont need to use ; or press ENTER to separate statements. The previous program can be written in one line.
See "What is your name? " give cName see "Hello " + cName
// See "Bye!"
NINE
The next program prints the Hello World message on the screen (std-out).
put "Hello World"
to run the program, save the code in a file, for example : hello.ring then from the command line or terminal, run it
using the ring interpreter
ring hello.ring
Since the Ring language is not case-sensitive, the same program can be written in different styles
Tip: Its better to select one style and use it in all of the program source code
Using Ring we can write multi-line literal, see the next example
Put "
Hello
Welcome to the Ring programming language
How are you?
"
Also you can use the nl constant to insert new line and you can use the + operator to concatenate strings
46
Ring Documentation, Release 1.2
Note: nl value means a new line and the actual codes that represent a newline is different between operating systems
You can get the input from the user using the get command
Put "What is your name? "
Get cName
Put "Hello " + cName
You dont need to use ; or press ENTER to separate statements. The previous program can be written in one line.
Put "What is your name? " get cName put "Hello " + cName
// Put "Bye!"
TEN
The next program prints the Hello World message on the screen (std-out).
load "stdlib.ring"
print("Hello World")
to run the program, save the code in a file, for example : hello.ring then from the command line or terminal, run it
using the ring interpreter
ring hello.ring
Since the Ring language is not case-sensitive, the same program can be written in different styles
Tip: Its better to select one style and use it in all of the program source code
LOAD "stdlib.ring"
PRINT("Hello World")
Load "stdlib.ring"
Print("Hello World")
Using Ring we can write multi-line literal, see the next example
Load "stdlib.ring"
Print("
Hello
Welcome to the Ring programming language
How are you?
48
Ring Documentation, Release 1.2
")
Also you can use the \n to insert new line and you can use #{variable_name} to insert variables values.
Load "stdlib.ring"
Print( "Hello\nWelcome to the Ring programming language\nHow are you?")
You can get the input from the user using the getstring() function
Load "stdlib.ring"
Print("What is your name? ")
cName = GetString()
Print("Hello #{cName}")
You dont need to use ; or press ENTER to separate statements. The previous program can be written in one line.
Load "stdlib.ring"
Print("What is your name? ") cName=getstring() print("Hello #{cName}")
Load "stdlib.ring"
// print("Bye!")