I am not able to print values ranging from 30 to 50 both inclusive in APL.
Actually I tried so much operators but not working.
What are your constraints? Do you want to define a function or do you just want to know how to iterate? Does "print" mean return as result or literally print to somewhere (output/file)?
In the easiest way, use iota ⍳
to iterate through the distance between the two bounds, then add the lower one to the results. Assuming index origin IO
is set to 0
:
30 + ⍳21
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
If IO
is set to 1
, lower the lower bound:
29 + ⍳21
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
You can always inspect or set IO
using ⎕IO
if you wanted to switch:
⎕IO ← 0
0