t = () condition = true for i = 1:N if condition==true t = (t..., i) end end
This does not modify the tuple but replaces it with a new longer one. On Tuesday, August 30, 2016 at 7:26:29 AM UTC+2, Alexei Serdiuk wrote: > > Hi, > > I need to choose items from a range (1:N) according to some condition and > to push them into a tuple. > > I understand how to add items into an array: > t=Array() > for i = 1:N > if condition==true > push!(t, i) > end; end > > Is there a way to push them into a tuple? > > Thanks. >