Getting Started - Third Style

Hello World

The next program prints the Hello World message on the screen (std-out).

print("Hello, World!\n")

Run the program

to run the program, save the code in a file, for example : hello.ring then from the command line or terminal, run it using Ring

ring hello.ring

Create Executable File

Using Ring2EXE we can create executable file for our application

ring2exe hello.ring -static

The -static option will avoid the need to ring.dll||ring.dylib

ring2exe hello.ring -dist -allruntime -noqt -noallegro

Not Case-Sensitive

Since the Ring language is not case-sensitive, the same program can be written in different styles


It’s better to select one style and use it in all of the program source code

PRINT("Hello World")
Print("Hello World")

Multi-Line literals

Using Ring we can write multi-line literal, see the next example

        Welcome to the Ring programming language
        How are you?


Also you can use the \n to insert new line and you can use #{variable_name} to insert variables values.

Print( "Hello\nWelcome to the Ring programming language\nHow are you?")

Getting Input

You can get the input from the user using the getstring() function

Print("What is your name? ")
cName = GetString()
Print("Hello #{cName}")

No Explicit End For Statements

You don’t need to use ‘;’ or press ENTER to separate statements. The previous program can be written in one line.

Print("What is your name? ") cName=getstring() print("Hello #{cName}")

Writing Comments

We can write one line comments and multi-line comments

The comment starts with # or //

Multi-lines comments are written between /* and */

        Program Name : My first program using Ring
        Date         : 2016.09.09
        Author       : Mahmoud Fayed

Print("What is your name? ")    # print message on screen
cName=GetString()               # get input from the user
print("Hello #{cName}")         # say hello!

// print("Bye!")


Using // to comment a lines of code is just a code style.

Puts() function

print the value then print new line (nl)




Puts("Hello, World!")

Print2Str() Function


print2Str(string) ---> String


world = "World!"
mystring = print2str("Hello, #{world} \nIn Year \n#{2000+17} \n")

see mystring + nl


Hello, World!
In Year

GetString() function

Get input from the keyboard - return value as string

getstring() ---> string

GetNumber() function

Get input from the keyboard - return value as number

getnumber() ---> number