2 single: The Type Hints Library; Introduction to the Type Hints Library
4 ======================================
5 Introduction to the Type Hints Library
6 ======================================
8 In this chapter we will learn about the Type Hints Library
12 pair: The Type Hints Library; Why Type Hints?
17 Using this library we can add the type information to the source code which will be
18 very useful for tools like
23 .. note:: Ring is a dynamic language, No type checking will be done by the compiler.
26 pair: The Type Hints Library; Example
31 The next example will use the Type Hints library
38 see sayHello("Mahmoud");
40 int func sum(int x,int y) {
44 string func sayHello(string name) {
45 return "Hello " + name ;
49 pair: The Type Hints Library; User Types
54 The Type Hints library is very powerful and will support user types (Classes) automatically
64 test() { main([:one,:two,:three]) }
67 see "Testing User Types!" + nl
72 public class myclass {
73 public static void func main(list args) {
81 pair: The Type Hints Library; Using Types inside Code
83 Using Types inside Code
84 =======================
86 Also you can use the types inside the code (not only the function prototype)
95 string msg = sayHello("Mahmoud")
97 see "Sum = " + sum + nl + msg + nl
100 int func sum(int x,int y) {
104 string func sayHello(string name) {
105 return "Hello " + name ;
109 pair: The Type Hints Library; Rules
114 * To use the types in the function prototype you must use '(' and ')' around parameters
115 * To use the types in the function code, You must set the variable value (Assignment).
117 The next types are defined by the library