List as a function argument
Posted: Mon Sep 04, 2017 1:26 pm
Dear All,
If we call a function with a list parameter, shall we always convert the argument into a local list variable explicitly in the function's body, like below:
if all_even_numbers(list_of_my_layers) = True {// do this...}
***
Function body: all_even_numbers(list_of_my_layers)
var list_of_elements = list_of_my_layers.toList
//do the check
//...
// return True or False
If there are options, could you please list them ?
Is that list passed to a function as a reference, or as a copy? So can a function change its list-argument, or it only works with a copy of the list?
If we call a function with a list parameter, shall we always convert the argument into a local list variable explicitly in the function's body, like below:
if all_even_numbers(list_of_my_layers) = True {// do this...}
***
Function body: all_even_numbers(list_of_my_layers)
var list_of_elements = list_of_my_layers.toList
//do the check
//...
// return True or False
If there are options, could you please list them ?
Is that list passed to a function as a reference, or as a copy? So can a function change its list-argument, or it only works with a copy of the list?