use codeblock in function