problem to increment 1 point to scalar

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

problem to increment 1 point to scalar

LucaLuca
hi,

val=0;

val++
ans=0;  =====> it sould be egual to 1

val++

and=1;



the first inctruction (val++)  it's =0..but it should be equal to 1





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: problem to increment 1 point to scalar

marco atzeri-2
Am 06.08.2018 um 14:08 schrieb LucaLuca:
> hi,
>
> val=0;
>
> val++
> ans=0;  =====> it sould be egual to 1
>

you are wrong. the ++ is post so
val is incremented after printing the output

octave:5> val=0
val = 0
octave:6> val++
ans = 0
octave:7> val
val =  1

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren gepr├╝ft.
https://www.avast.com/antivirus