NetBeans Code Template for Calling a Function with Default Null Arguments

My code template is as follows:

test( $a = ${null}, $b = ${null} ); 

When I call it, the first choice of $a will be null .
After editing this value, the second variable $b also changes to the same value at the same time.

Is it possible to make it independent?

+4
source share
2 answers

You can also enter the default value = "default value" after the variable name, for example:

 test( $a = ${firstarg default="null"}, $b = ${secondarg default="null"} ); 

This solution worked for me, and I found that it was looking at predefined code templates. They are very useful and explain themselves.

+2
source

The value in braces is the "name" of the variable. If both parameters are set to null , you tell the template that they are the same variable. Change the names to arga and argb and you should be golden.

If you use the same name for constructs such as:

 foreach (${array} as $$${value}) echo $$${value} 
+1
source

Source: https://habr.com/ru/post/1342058/


All Articles