How works for loop ?

How works for loop ? - for loop generates extra zeros - Messaggi

#1 Pubblicato: 19/04/2019 10:09:59
inazuma

inazuma

0 apprezzamenti in 1 post.

Gruppo: User

Hello,

I'm a newbie in SMath, so maybe it's just a bad usage.

Why the following for loop:

I:=[5..10]
for i € I
xi := i

generate this result:
x=[0 0 0 0 5 6 7 8 9 10]

Thank you for your answer !
#2 Pubblicato: 19/04/2019 10:51:58
Martin_B

Martin_B

22 apprezzamenti in 84 post.

Gruppo: User

You are assigning the values 5 to 10 to the 5th, 6th ...up to 10th element of the vector x.
The first 4 elements are filled with zeros.
1 utenti hanno apprezzato questo post
Davide Carpi 20/04/2019 05:37:00
#3 Pubblicato: 19/04/2019 20:51:22
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: User

Wrote

Why the following for loop:


Pad.PNG
1 utenti hanno apprezzato questo post
Davide Carpi 20/04/2019 05:37:00
  • Nuovi post
  • Nessun nuovo post