SlideShare a Scribd company logo
1 of 10
Download to read offline
Ring Documentation, Release 1.9
Func IsMainSourceFile
if PrevFileName() = sysargv[2]
return true
ok
return false
36.16 CurrentDir() Function
Return the path of the current directory
Syntax:
CurrenDir() ---> String contains the path of the currect directory
36.17 ExeFileName() Function
Return the Ring executable file name
Syntax:
exefilename() ---> String contains the Ring executable file name
36.18 ChDir() Function
Change the current directory
Syntax:
ChDir(cNewPath)
36.19 ExeFolder() Function
Return the Ring executable file path
Syntax:
exefolder() ---> String contains the Ring executable path
36.20 Version() Function
Return the Ring version
Syntax:
version() ---> String contains the Ring version
Output:
36.16. CurrentDir() Function 299
Ring Documentation, Release 1.9
1.9
36.21 Shutdown() Function
Close the application
Syntax:
shutdown(nStatus) ---> Close the application
36.21. Shutdown() Function 300
CHAPTER
THIRTYSEVEN
EVAL() AND DEBUGGING
In this chapter we are going to learn about
• Error Handling using Try/Catch/Done
• Eval() function
• Raise() function
• Assert() function
37.1 Try/Catch/Done
Syntax:
Try
Statements...
Catch
Statements...
Done
The statements in the Try block will be executed, if any error happens then the statements in the catch block will be
executed.
Inside the catch block we can use the variable cCatchError to get the error message
Example:
Try
see 5/0
Catch
see "Catch!" + nl + cCatchError
Done
Output:
Catch!
Error (R1) : Cann't divide by zero !
37.2 Eval() Function
We can execute code during the runtime from string using the Eval() function
Syntax:
301
Ring Documentation, Release 1.9
Eval(cCode)
Example:
Eval("nOutput = 5+2*5 " )
See "5+2*5 = " + nOutput + nl
Eval("for x = 1 to 10 see x + nl next")
Eval("func test see 'message from test!' ")
test()
Output:
5+2*5 = 15
1
2
3
4
5
6
7
8
9
10
message from test!
We can use the Return command to return a value
Example:
see Eval("return 5*5")
Output:
25
37.3 Raise() Function
We can raise an exception using the Raise() function
Syntax:
Raise(cErrorMessage)
The function will display the error message then end the execution of the program.
We can use Try/Catch/Done to avoid exceptions generated by raise() function.
Example:
nMode = 10
if nMode < 0 or nMode > 5
raise("Error : nMode not in the range 1:4")
ok
Output:
Line 4 Error : nMode not in the range 1:4
In raise in file testsraise.ring
37.3. Raise() Function 302
Ring Documentation, Release 1.9
Example:
try
testmode(6)
catch
see "avoid raise!"
done
testmode(-1)
func testmode nMode
if nMode < 0 or nMode > 5
raise("Error : nMode not in the range 1:4")
ok
Output:
avoid raise!
Line 12 Error : nMode not in the range 1:4
In raise In function testmode() in file testsraise2.ring
called from line 7 in file testsraise2.ring
37.4 Assert() Function
We can use the Assert() function to test conditions before executing the code
If the test fail the program will be terminated with an error message contains the assert condition.
Syntax:
Assert( condition )
Example:
x = 10
assert( x = 10)
assert( x = 100 )
Output:
Line 3 Assertion Failed!
In assert in file testsassert.ring
37.4. Assert() Function 303
CHAPTER
THIRTYEIGHT
DEMO PROGRAMS
In this chapter we will see simple demo programs
• Language Shell
• Main Menu
38.1 Language Shell
We can create simple interactive programming environment using the next program
while true
see nl + "code:> "
give cCode
try
eval(cCode)
catch
see cCatchError
done
end
Output:
code:> see "hello world"
hello world
code:> for x = 1 to 10 see x + nl next
1
2
3
4
5
6
7
8
9
10
code:> func test see "Hello from test" + nl
code:> test()
Hello from test
code:> bye
304
Ring Documentation, Release 1.9
38.2 Main Menu
Example:
# Demo Program
while true
see "
Main Menu
===========
[1] Say Hello
[2] Sum two numbers
[3] Stars
[4] Fact
[5] Exit
" give nMenu see nl
# we can use Switch-ON-Other-OFF instead of IF-BUT-ELSE-OK
Switch nMenu
On 1 sayhello()
On 2 Sum()
On 3 Stars()
On 4
see "Enter Number : " give x
see "Output : "
Try
see Fact(number(x))
Catch
see "Error in parameters!" + nl
Done
On "5" return
Other see "bad option" + nl
Off
end
func sayhello
see "Enter your name ? " give fname
see "Hello " + fname + nl
func sum
see "number 1 : " give num1 see "number 2 : " give num2
see "Sum : " see 0 + num1 + num2
func stars
for x = 1 to 10
see space(8)
for y = 1 to x see "*" next see nl
next
func fact x if x = 0 return 1 else return x * fact(x-1) ok
38.2. Main Menu 305
Ring Documentation, Release 1.9
func space x y = "" for t=1 to x y += " " next return y
Output:
Main Menu
===========
[1] Say Hello
[2] Sum two numbers
[3] Stars
[4] Fact
[5] Exit
1
Enter your name ? Mahmoud Fayed
Hello Mahmoud Fayed
Main Menu
===========
[1] Say Hello
[2] Sum two numbers
[3] Stars
[4] Fact
[5] Exit
2
number 1 : 3
number 2 : 4
Sum : 7
Main Menu
===========
[1] Say Hello
[2] Sum two numbers
[3] Stars
[4] Fact
[5] Exit
3
*
**
***
****
*****
******
*******
********
*********
**********
Main Menu
===========
[1] Say Hello
[2] Sum two numbers
38.2. Main Menu 306
Ring Documentation, Release 1.9
[3] Stars
[4] Fact
[5] Exit
4
Enter Number : 5
Output : 120
Main Menu
===========
[1] Say Hello
[2] Sum two numbers
[3] Stars
[4] Fact
[5] Exit
5
38.2. Main Menu 307
CHAPTER
THIRTYNINE
ODBC FUNCTIONS
This chapter contains the ODBC functions provided by the Ring programming language.
• odbc_init()
• odbc_drivers()
• odbc_datasources()
• odbc_close()
• odbc_connect()
• odbc_disconnect()
• odbc_execute()
• odbc_colcount()
• odbc_fetch()
• odbc_getdata()
• odbc_tables()
• odbc_columns()
• odbc_autocommit()
• odbc_commit()
• odbc_rollback()
Before using the next function load the odbclib.ring library
load "odbclib.ring"
# Use ODBC functions
39.1 odbc_init() Function
We can create ODBC Handle using the odbc_init() function
Syntax:
odbc_init() ---> ODBC Handle
308

More Related Content

What's hot

The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 27 of 184
The Ring programming language version 1.5.3 book - Part 27 of 184The Ring programming language version 1.5.3 book - Part 27 of 184
The Ring programming language version 1.5.3 book - Part 27 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 25 of 180
The Ring programming language version 1.5.1 book - Part 25 of 180The Ring programming language version 1.5.1 book - Part 25 of 180
The Ring programming language version 1.5.1 book - Part 25 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 23 of 88
The Ring programming language version 1.3 book - Part 23 of 88The Ring programming language version 1.3 book - Part 23 of 88
The Ring programming language version 1.3 book - Part 23 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 5 of 30
The Ring programming language version 1.4 book - Part 5 of 30The Ring programming language version 1.4 book - Part 5 of 30
The Ring programming language version 1.4 book - Part 5 of 30Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 101 of 212
The Ring programming language version 1.10 book - Part 101 of 212The Ring programming language version 1.10 book - Part 101 of 212
The Ring programming language version 1.10 book - Part 101 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 31 of 202
The Ring programming language version 1.8 book - Part 31 of 202The Ring programming language version 1.8 book - Part 31 of 202
The Ring programming language version 1.8 book - Part 31 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 21 of 84
The Ring programming language version 1.2 book - Part 21 of 84The Ring programming language version 1.2 book - Part 21 of 84
The Ring programming language version 1.2 book - Part 21 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 91 of 196
The Ring programming language version 1.7 book - Part 91 of 196The Ring programming language version 1.7 book - Part 91 of 196
The Ring programming language version 1.7 book - Part 91 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 19 of 181
The Ring programming language version 1.5.2 book - Part 19 of 181The Ring programming language version 1.5.2 book - Part 19 of 181
The Ring programming language version 1.5.2 book - Part 19 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 6 of 88
The Ring programming language version 1.3 book - Part 6 of 88The Ring programming language version 1.3 book - Part 6 of 88
The Ring programming language version 1.3 book - Part 6 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 5 of 31
The Ring programming language version 1.4.1 book - Part 5 of 31The Ring programming language version 1.4.1 book - Part 5 of 31
The Ring programming language version 1.4.1 book - Part 5 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 32 of 185
The Ring programming language version 1.5.4 book - Part 32 of 185The Ring programming language version 1.5.4 book - Part 32 of 185
The Ring programming language version 1.5.4 book - Part 32 of 185Mahmoud Samir Fayed
 
Dts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlinDts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlinAhmad Arif Faizin
 

What's hot (20)

The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212The Ring programming language version 1.10 book - Part 35 of 212
The Ring programming language version 1.10 book - Part 35 of 212
 
The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196The Ring programming language version 1.7 book - Part 30 of 196
The Ring programming language version 1.7 book - Part 30 of 196
 
The Ring programming language version 1.5.3 book - Part 27 of 184
The Ring programming language version 1.5.3 book - Part 27 of 184The Ring programming language version 1.5.3 book - Part 27 of 184
The Ring programming language version 1.5.3 book - Part 27 of 184
 
The Ring programming language version 1.5.1 book - Part 25 of 180
The Ring programming language version 1.5.1 book - Part 25 of 180The Ring programming language version 1.5.1 book - Part 25 of 180
The Ring programming language version 1.5.1 book - Part 25 of 180
 
The Ring programming language version 1.3 book - Part 23 of 88
The Ring programming language version 1.3 book - Part 23 of 88The Ring programming language version 1.3 book - Part 23 of 88
The Ring programming language version 1.3 book - Part 23 of 88
 
The Ring programming language version 1.4 book - Part 5 of 30
The Ring programming language version 1.4 book - Part 5 of 30The Ring programming language version 1.4 book - Part 5 of 30
The Ring programming language version 1.4 book - Part 5 of 30
 
The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210The Ring programming language version 1.9 book - Part 40 of 210
The Ring programming language version 1.9 book - Part 40 of 210
 
The Ring programming language version 1.10 book - Part 101 of 212
The Ring programming language version 1.10 book - Part 101 of 212The Ring programming language version 1.10 book - Part 101 of 212
The Ring programming language version 1.10 book - Part 101 of 212
 
The Ring programming language version 1.8 book - Part 31 of 202
The Ring programming language version 1.8 book - Part 31 of 202The Ring programming language version 1.8 book - Part 31 of 202
The Ring programming language version 1.8 book - Part 31 of 202
 
The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189The Ring programming language version 1.6 book - Part 34 of 189
The Ring programming language version 1.6 book - Part 34 of 189
 
The Ring programming language version 1.2 book - Part 21 of 84
The Ring programming language version 1.2 book - Part 21 of 84The Ring programming language version 1.2 book - Part 21 of 84
The Ring programming language version 1.2 book - Part 21 of 84
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
 
The Ring programming language version 1.7 book - Part 91 of 196
The Ring programming language version 1.7 book - Part 91 of 196The Ring programming language version 1.7 book - Part 91 of 196
The Ring programming language version 1.7 book - Part 91 of 196
 
C++ practical
C++ practicalC++ practical
C++ practical
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189
 
The Ring programming language version 1.5.2 book - Part 19 of 181
The Ring programming language version 1.5.2 book - Part 19 of 181The Ring programming language version 1.5.2 book - Part 19 of 181
The Ring programming language version 1.5.2 book - Part 19 of 181
 
The Ring programming language version 1.3 book - Part 6 of 88
The Ring programming language version 1.3 book - Part 6 of 88The Ring programming language version 1.3 book - Part 6 of 88
The Ring programming language version 1.3 book - Part 6 of 88
 
The Ring programming language version 1.4.1 book - Part 5 of 31
The Ring programming language version 1.4.1 book - Part 5 of 31The Ring programming language version 1.4.1 book - Part 5 of 31
The Ring programming language version 1.4.1 book - Part 5 of 31
 
The Ring programming language version 1.5.4 book - Part 32 of 185
The Ring programming language version 1.5.4 book - Part 32 of 185The Ring programming language version 1.5.4 book - Part 32 of 185
The Ring programming language version 1.5.4 book - Part 32 of 185
 
Dts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlinDts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlin
 

Similar to The Ring programming language version 1.9 book - Part 34 of 210

The Ring programming language version 1.10 book - Part 34 of 212
The Ring programming language version 1.10 book - Part 34 of 212The Ring programming language version 1.10 book - Part 34 of 212
The Ring programming language version 1.10 book - Part 34 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 28 of 189
The Ring programming language version 1.6 book - Part 28 of 189The Ring programming language version 1.6 book - Part 28 of 189
The Ring programming language version 1.6 book - Part 28 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 25 of 185
The Ring programming language version 1.5.4 book - Part 25 of 185The Ring programming language version 1.5.4 book - Part 25 of 185
The Ring programming language version 1.5.4 book - Part 25 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 32 of 210
The Ring programming language version 1.9 book - Part 32 of 210The Ring programming language version 1.9 book - Part 32 of 210
The Ring programming language version 1.9 book - Part 32 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 188 of 194
The Ring programming language version 1.5.3 book - Part 188 of 194The Ring programming language version 1.5.3 book - Part 188 of 194
The Ring programming language version 1.5.3 book - Part 188 of 194Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 33 of 210
The Ring programming language version 1.9 book - Part 33 of 210The Ring programming language version 1.9 book - Part 33 of 210
The Ring programming language version 1.9 book - Part 33 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 7 of 181
The Ring programming language version 1.5.2 book - Part 7 of 181The Ring programming language version 1.5.2 book - Part 7 of 181
The Ring programming language version 1.5.2 book - Part 7 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 42 of 210
The Ring programming language version 1.9 book - Part 42 of 210The Ring programming language version 1.9 book - Part 42 of 210
The Ring programming language version 1.9 book - Part 42 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 31 of 181
The Ring programming language version 1.5.2 book - Part 31 of 181The Ring programming language version 1.5.2 book - Part 31 of 181
The Ring programming language version 1.5.2 book - Part 31 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 14 of 212
The Ring programming language version 1.10 book - Part 14 of 212The Ring programming language version 1.10 book - Part 14 of 212
The Ring programming language version 1.10 book - Part 14 of 212Mahmoud Samir Fayed
 

Similar to The Ring programming language version 1.9 book - Part 34 of 210 (18)

The Ring programming language version 1.10 book - Part 34 of 212
The Ring programming language version 1.10 book - Part 34 of 212The Ring programming language version 1.10 book - Part 34 of 212
The Ring programming language version 1.10 book - Part 34 of 212
 
The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189The Ring programming language version 1.6 book - Part 183 of 189
The Ring programming language version 1.6 book - Part 183 of 189
 
The Ring programming language version 1.6 book - Part 28 of 189
The Ring programming language version 1.6 book - Part 28 of 189The Ring programming language version 1.6 book - Part 28 of 189
The Ring programming language version 1.6 book - Part 28 of 189
 
The Ring programming language version 1.5.4 book - Part 25 of 185
The Ring programming language version 1.5.4 book - Part 25 of 185The Ring programming language version 1.5.4 book - Part 25 of 185
The Ring programming language version 1.5.4 book - Part 25 of 185
 
The Ring programming language version 1.9 book - Part 32 of 210
The Ring programming language version 1.9 book - Part 32 of 210The Ring programming language version 1.9 book - Part 32 of 210
The Ring programming language version 1.9 book - Part 32 of 210
 
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88
 
The Ring programming language version 1.5.3 book - Part 188 of 194
The Ring programming language version 1.5.3 book - Part 188 of 194The Ring programming language version 1.5.3 book - Part 188 of 194
The Ring programming language version 1.5.3 book - Part 188 of 194
 
The Ring programming language version 1.9 book - Part 33 of 210
The Ring programming language version 1.9 book - Part 33 of 210The Ring programming language version 1.9 book - Part 33 of 210
The Ring programming language version 1.9 book - Part 33 of 210
 
The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88The Ring programming language version 1.3 book - Part 24 of 88
The Ring programming language version 1.3 book - Part 24 of 88
 
The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181The Ring programming language version 1.5.2 book - Part 24 of 181
The Ring programming language version 1.5.2 book - Part 24 of 181
 
The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31
 
The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185The Ring programming language version 1.5.4 book - Part 33 of 185
The Ring programming language version 1.5.4 book - Part 33 of 185
 
The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181
 
The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180
 
The Ring programming language version 1.5.2 book - Part 7 of 181
The Ring programming language version 1.5.2 book - Part 7 of 181The Ring programming language version 1.5.2 book - Part 7 of 181
The Ring programming language version 1.5.2 book - Part 7 of 181
 
The Ring programming language version 1.9 book - Part 42 of 210
The Ring programming language version 1.9 book - Part 42 of 210The Ring programming language version 1.9 book - Part 42 of 210
The Ring programming language version 1.9 book - Part 42 of 210
 
The Ring programming language version 1.5.2 book - Part 31 of 181
The Ring programming language version 1.5.2 book - Part 31 of 181The Ring programming language version 1.5.2 book - Part 31 of 181
The Ring programming language version 1.5.2 book - Part 31 of 181
 
The Ring programming language version 1.10 book - Part 14 of 212
The Ring programming language version 1.10 book - Part 14 of 212The Ring programming language version 1.10 book - Part 14 of 212
The Ring programming language version 1.10 book - Part 14 of 212
 

More from Mahmoud Samir Fayed

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

More from Mahmoud Samir Fayed (20)

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

Recently uploaded

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 

Recently uploaded (20)

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 

The Ring programming language version 1.9 book - Part 34 of 210

  • 1. Ring Documentation, Release 1.9 Func IsMainSourceFile if PrevFileName() = sysargv[2] return true ok return false 36.16 CurrentDir() Function Return the path of the current directory Syntax: CurrenDir() ---> String contains the path of the currect directory 36.17 ExeFileName() Function Return the Ring executable file name Syntax: exefilename() ---> String contains the Ring executable file name 36.18 ChDir() Function Change the current directory Syntax: ChDir(cNewPath) 36.19 ExeFolder() Function Return the Ring executable file path Syntax: exefolder() ---> String contains the Ring executable path 36.20 Version() Function Return the Ring version Syntax: version() ---> String contains the Ring version Output: 36.16. CurrentDir() Function 299
  • 2. Ring Documentation, Release 1.9 1.9 36.21 Shutdown() Function Close the application Syntax: shutdown(nStatus) ---> Close the application 36.21. Shutdown() Function 300
  • 3. CHAPTER THIRTYSEVEN EVAL() AND DEBUGGING In this chapter we are going to learn about • Error Handling using Try/Catch/Done • Eval() function • Raise() function • Assert() function 37.1 Try/Catch/Done Syntax: Try Statements... Catch Statements... Done The statements in the Try block will be executed, if any error happens then the statements in the catch block will be executed. Inside the catch block we can use the variable cCatchError to get the error message Example: Try see 5/0 Catch see "Catch!" + nl + cCatchError Done Output: Catch! Error (R1) : Cann't divide by zero ! 37.2 Eval() Function We can execute code during the runtime from string using the Eval() function Syntax: 301
  • 4. Ring Documentation, Release 1.9 Eval(cCode) Example: Eval("nOutput = 5+2*5 " ) See "5+2*5 = " + nOutput + nl Eval("for x = 1 to 10 see x + nl next") Eval("func test see 'message from test!' ") test() Output: 5+2*5 = 15 1 2 3 4 5 6 7 8 9 10 message from test! We can use the Return command to return a value Example: see Eval("return 5*5") Output: 25 37.3 Raise() Function We can raise an exception using the Raise() function Syntax: Raise(cErrorMessage) The function will display the error message then end the execution of the program. We can use Try/Catch/Done to avoid exceptions generated by raise() function. Example: nMode = 10 if nMode < 0 or nMode > 5 raise("Error : nMode not in the range 1:4") ok Output: Line 4 Error : nMode not in the range 1:4 In raise in file testsraise.ring 37.3. Raise() Function 302
  • 5. Ring Documentation, Release 1.9 Example: try testmode(6) catch see "avoid raise!" done testmode(-1) func testmode nMode if nMode < 0 or nMode > 5 raise("Error : nMode not in the range 1:4") ok Output: avoid raise! Line 12 Error : nMode not in the range 1:4 In raise In function testmode() in file testsraise2.ring called from line 7 in file testsraise2.ring 37.4 Assert() Function We can use the Assert() function to test conditions before executing the code If the test fail the program will be terminated with an error message contains the assert condition. Syntax: Assert( condition ) Example: x = 10 assert( x = 10) assert( x = 100 ) Output: Line 3 Assertion Failed! In assert in file testsassert.ring 37.4. Assert() Function 303
  • 6. CHAPTER THIRTYEIGHT DEMO PROGRAMS In this chapter we will see simple demo programs • Language Shell • Main Menu 38.1 Language Shell We can create simple interactive programming environment using the next program while true see nl + "code:> " give cCode try eval(cCode) catch see cCatchError done end Output: code:> see "hello world" hello world code:> for x = 1 to 10 see x + nl next 1 2 3 4 5 6 7 8 9 10 code:> func test see "Hello from test" + nl code:> test() Hello from test code:> bye 304
  • 7. Ring Documentation, Release 1.9 38.2 Main Menu Example: # Demo Program while true see " Main Menu =========== [1] Say Hello [2] Sum two numbers [3] Stars [4] Fact [5] Exit " give nMenu see nl # we can use Switch-ON-Other-OFF instead of IF-BUT-ELSE-OK Switch nMenu On 1 sayhello() On 2 Sum() On 3 Stars() On 4 see "Enter Number : " give x see "Output : " Try see Fact(number(x)) Catch see "Error in parameters!" + nl Done On "5" return Other see "bad option" + nl Off end func sayhello see "Enter your name ? " give fname see "Hello " + fname + nl func sum see "number 1 : " give num1 see "number 2 : " give num2 see "Sum : " see 0 + num1 + num2 func stars for x = 1 to 10 see space(8) for y = 1 to x see "*" next see nl next func fact x if x = 0 return 1 else return x * fact(x-1) ok 38.2. Main Menu 305
  • 8. Ring Documentation, Release 1.9 func space x y = "" for t=1 to x y += " " next return y Output: Main Menu =========== [1] Say Hello [2] Sum two numbers [3] Stars [4] Fact [5] Exit 1 Enter your name ? Mahmoud Fayed Hello Mahmoud Fayed Main Menu =========== [1] Say Hello [2] Sum two numbers [3] Stars [4] Fact [5] Exit 2 number 1 : 3 number 2 : 4 Sum : 7 Main Menu =========== [1] Say Hello [2] Sum two numbers [3] Stars [4] Fact [5] Exit 3 * ** *** **** ***** ****** ******* ******** ********* ********** Main Menu =========== [1] Say Hello [2] Sum two numbers 38.2. Main Menu 306
  • 9. Ring Documentation, Release 1.9 [3] Stars [4] Fact [5] Exit 4 Enter Number : 5 Output : 120 Main Menu =========== [1] Say Hello [2] Sum two numbers [3] Stars [4] Fact [5] Exit 5 38.2. Main Menu 307
  • 10. CHAPTER THIRTYNINE ODBC FUNCTIONS This chapter contains the ODBC functions provided by the Ring programming language. • odbc_init() • odbc_drivers() • odbc_datasources() • odbc_close() • odbc_connect() • odbc_disconnect() • odbc_execute() • odbc_colcount() • odbc_fetch() • odbc_getdata() • odbc_tables() • odbc_columns() • odbc_autocommit() • odbc_commit() • odbc_rollback() Before using the next function load the odbclib.ring library load "odbclib.ring" # Use ODBC functions 39.1 odbc_init() Function We can create ODBC Handle using the odbc_init() function Syntax: odbc_init() ---> ODBC Handle 308