You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---@classLinQ:tablelib---@returnLinQfunctionLinQ() end---@genericT,K,V---@paramtblT|table<K, V>---@paramquery?fun(a: V): boolean---@returnTfunctiontable.whereList(tbl, query) end---@paramtbltable---@returnbooleanfunctiontable.isEmpty(tbl) end---@typeinteger[]|LinQlocalintArray=LinQ {};
fori=1, 10dointArray:insert(math.random(1, 10));
end---now the array is either empty or filled with ones and\or twoslocallist=intArray:whereList(function(element)
returnelement==1orelement==2end)
---we make sure that there is something in the array and sort itifnotlist:isEmpty() thenlist:sort(function(a, b) returna>bend)
---after sorting, there should be the maximum number from the arraylocalfirstEl=list[1];
end
Maybe I'm doing something wrong, if that's the case, tell me how it should be.
The text was updated successfully, but these errors were encountered:
Maybe I'm doing something wrong, if that's the case, tell me how it should be.
The text was updated successfully, but these errors were encountered: