[riscosfr] Re: [riscosfr] Problème de LOCAL

  • From: Bruno d'Arcangeli <bruno@xxxxxxxxxxxxx>
  • To: riscosfr@xxxxxxxxxxxxx
  • Date: Fri, 6 Feb 2015 18:52:16 +0100

Le Fri, Feb 06, 2015 at 06:00:30PM +0100, Cocoa Pod a écrit:
> Oui, en sortant les tableaux des procédures, ça marche! Mais ça n’explique 
> pas pourquoi la documentation décrit des tableaux déclarés en LOCAL. 
> Ci-dessous l’exemple de la doc. Donc Je ne comprends pas pourquoi quand 
> j’applique la doc, ça ne marche pas!
> Le Basic n’est pas non plus ma tasse de thé! Je fais ça juste pour participer 
> au concours que je trouve rigolo.
> A+
>   Miguel
> 
> When you declare a local array, the LOCAL statement must be followed by a DIM
> statement to dimension the local array. For example, consider the following 
> function
> which, when passed two vectors of the same size, returns their scalar product:
> 
> 100 DEF FNscalar_product(A(),B())
> 110 REM ** Both arrays must have a dimension of 1 **
> 120 IF DIM(A()) <> 1 OR DIM(B()) <> 1 THEN
> 130 PRINT "Vectors required"
> 140 =0
> 150 ENDIF
> 160 REM ** Both arrays must be the same size **
> 170 IF DIM(A(),1) <> DIM(B(),1) THEN
> 180 PRINT "Vectors must be of same size"
> 190 =0
> 200 ENDIF
> 210 REM ** Create a temporary array of the same size **
> 220 LOCAL C()
> 230 DIM C(DIM(A(),1))

Remarque bien les deux lignes ci-dessus.

> 240 REM ** Multiply the corresponding elements and place in C() **
> 250 C() = A()*B()
> 260 REM ** Finally sum all the elements of C() **
> 270 =SUM(C())
> 
> 
> > Le Fri, Feb 06, 2015 at 01:18:15PM +0100, Cocoa Pod a écrit:
> >> REM  calcul dates --------------------------------------------------
> >> DEF PROCdoQunu ( Qu%(), Nd%(), cible%, RETURN delta% )
> >> 
> >> DIM Qn%(6,6) : Qn%() = Qu%()                                               
> >>         A
> >> DIM C%(6,3) : C%(4,0) = 0 : C%(4,1) = 1                                    
> >> B

Ils sont où tes LOCAL Qn() et LOCAL C() avant les DIM? ;-)

Amuse toi bien.

-- 
http://www.arcangeli.org


Other related posts: