In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Operaciones con Arrays

Foro de Xailer profesional en español
Responder
Daniel Pechir
Mensajes: 192
Registrado: Vie Mar 15, 2013 12:32 am

Operaciones con Arrays

Mensaje por Daniel Pechir »

HOLA

PERDON POR MI IGNORANCIA

TENGO UN ARRAY [n,13]

¿ COMO HAGO UN "SUM" DE TODOS LOS CAMPOS [n,1 ... 13] ?

¿ DEBE SER CON UN FOR - NEXT ?

¿ PODRIAN MOSTRARME UN EJEMPLO DE COMO HACER LA FUNCION ?

POR SU COMPRENSION

GRACIAS

DANIEL PECHIR TAGER
avitalini
Mensajes: 141
Registrado: Mié Ene 07, 2015 6:31 pm

Re: Operaciones con Arrays

Mensaje por avitalini »

Qué tal!

Podría ser con for next o for each

Código: Seleccionar todo

FUNCTION nSumaArrayForNext(aVariable)
	Local nIndice, nSuma:=0
	for nIndice:= 1 to Len( aVariable)
		nSuma+=aVariable[nIndice]
	end
RETURN nSuma

FUNCTION nSumaArrayForEach(aVariable)
	Local nElemento, nSuma:=0
	for each nElemento in  aVariable
		nSuma+=nElemento
	end
RETURN nSuma
Te podrían servir estas guías. http://www.kresin.ru/en/hrbfaq_3.html y https://en.wikipedia.org/wiki/Harbour_(software)

Saludos
Daniel Pechir
Mensajes: 192
Registrado: Vie Mar 15, 2013 12:32 am

Re: Operaciones con Arrays

Mensaje por Daniel Pechir »

AVITALINI: GRACIAS POR TU AYUDA

DANIEL
Responder