1

All C language programs must have a main() function. It's the core of every program but what was the purpose of including the "Main" function in the Ring programming language ?

what is the difference between this program

see "hello, world!"

and another one contains the Main function!

func main
    see "hello, world!"

Is this because someone would make a lot of statements as a preparation then use the "Main" function to start the execution of the real logic?

Lion King
  • 32,851
  • 25
  • 81
  • 143
Ibn Nile
  • 47
  • 4

1 Answers1

1

You need it to use the Local scope instead of the Global scope.

Example

x = 10
myfunc()
See "X value = " + X  # here i expect that x will be (10)
                # but i will get another value (6) because myfunc() uses x !
Func myfunc
  for x = 1 to 5
     See x + nl
  next

Output : X value = 6

Func Main 
  x = 10
  myfunc()
  See "X value = " + X                         

Func myfunc
  for x = 1 to 5
    See x + nl
  next

Output: X value = 10

msfclipper
  • 96
  • 3