My example of imperative does not work, why?

Hello dynos,

I try to understand imperativ and his practical use.
Do you know something about it f.e.:


Is there a Maths.Rand comment? or do i use wrong syntex?

Do you have other exampels?

KR

Andreas

This might help you out:

3 Likes

I have no idea… but if I write it as >>DSCore.Maths.Rand<< it goes grey


But it is still not working
i try random list
It could also be a tapstop problem, the output is 6 times cero so it adds nothing to the interation(i)

in Python i would use append! but in designScript i don`t know

KR

Andreas

You’re writing “Maths”, try DSCore.Math.Round(x).

Maths is from archilab.

3 Likes

Hahaha!! I didn’t spot that!

Surprised I personally don’t do that more often tbh.

I’ve got used to typing, “color” instead of “colour”…

Shame we can’t have proper English in Python as well as the American :laughing:

1 Like

i tried this, just for understanding:
Why i need “x” ?
f.e. when i say x = 1, every i+x is the same
Why does x know it is a float?

KR

Andreas

1 Like

You don’t need “x”, I’ve just used x for example purpose and, of course, because the function Round requires an argument.

In your case, when you use x = 1 the for loop add each i to the value:
image

This is interesting, although the function requires the input as integer, if you feed it with variables, it’ll output different numbers haha.

1 Like