How to define a function using the same loop variable

I was running this code and got the result as follows,

For[zr = 0.10, zr <= 0.50, zr = zr + 0.10,
zx = Tanh[zr]
Print[{zr, zx}]]

{0.1,0.781806 Null}

{0.2,0.099668 Null}

{0.3,0.197375 Null}

{0.4,0.291313 Null}

{0.5,0.379949 Null}
Please tell me the solution.

Hi,

I do not fully understand what you want to achieve, but I guess that there is at least one semi-colon missing:

For[zr = 0.10, zr <= 0.50, zr = zr + 0.10, zx = Tanh[zr]; Print[{zr, zx}]]

which gives:

{0.1,0.099668}
{0.2,0.197375}
{0.3,0.291313}
{0.4,0.379949}
{0.5,0.462117}

Cheers,

Marco

Thanks a lot to you Marco. It has solved my problem.