Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 24-Nov-2010 05:18:16

kenshin1987
Member
Registered: 10-Nov-2010
Posts: 100

about pre-declare fuction

Hi,

Is there any possible that we can pre-declare fuction in scol?

like C language

void  add(int a, int b);

main()
{
   add(1,2);
}

void add(int a ,int b)
{
  
}

Offline

#2 24-Nov-2010 06:35:07

kenshin1987
Member
Registered: 10-Nov-2010
Posts: 100

Re: about pre-declare fuction

Ok,I got it

/* functions which refer to each other */
proto g= fun[i] I;;
fun f(x)= if x>0 then 1+ g x-1 else 0;;
fun g(x)= if x>0 then 1+ f x-1 else 0;;

thanks guys

Offline

#3 24-Nov-2010 10:26:04

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: about pre-declare fuction

Hello,

When you pre delcare a Scol function, you must define it. A proto without its definition = crash

Offline

Board footer

Powered by FluxBB