說我有一個字符串n ='22'和另一個數字a = 4,所以n是一個str和a是一個int。我想創建一組列表,如: list1 = [22, 12, 2] #decreasing n by 10, the last item must be single digit, positive or 0
list2 = [22, 11, 0] #decreasing n by 11, last item
雖然尋找到Can you have a incrementor and a decrementor on the same variable in the same statement in c 我發現,你可以在一個變量幾個前綴遞增/遞減運算,但只有一個後綴 例如: ++--++foo; // valid
foo++--++; // invalid
--foo++; // invalid
private var _variable:int;
public function set variable(val:int):void{
_variable = val;
}
public function get variable():int{
return _variable
}
現在,如果我必須增加變量......哪一個更優化的方法呢? __i