<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script>
<div ng-app='app' ng-controller='ctrl'>
<button ng-click='addGrade()'>Add</button>
<div style="border-style: solid; width: 200px" ng-repeat='grade in grades'>
<label for="select{{$index}}">Grade {{$index}}:</label>
<select id='select{{$index}}' ng-model='grade.list'>
<option value="grade1">Grade 1</option>
<option value="grade2">Grade 2</option>
<option value="grade3">Grade 3</option>
<option value="grade4">Grade 4</option>
</select>
<br>
<label for="text{{$index}}">Text{{$index}}:</label>
<input id='text{{$index}}' type="text" ng-model='grade.text' size='10' />
</div>
{{grades}}
</div>
我收到错误消息:
否&#34;楼层&#34;候选人产生预期的语境结果类型&#34; Int&#34;
我进口了达尔文。
答案 0 :(得分:8)
HashSet<Integer> zipcodeSet = new HashSet<Integer>(Arrays.asList(zipcodeList));
duplicates = zipcodeSet.size()!=zipcodeList.length;
取一个Double并返回另一个Double。如果您希望它成为Int(与floor
匹配,则必须明确转换它:self.maxViewers
。
答案 1 :(得分:2)
使用round(_:)
方法
使用指定的舍入将值舍入为整数值 规则。
var w1 = 6.5
w1.round()
// w1 == 7.0
// Equivalent to the C 'round' function:
var w = 6.5
w.round(.toNearestOrAwayFromZero)
// w == 7.0
// Equivalent to the C 'trunc' function:
var x = 6.5
x.round(.towardZero)
// x == 6.0
// Equivalent to the C 'ceil' function:
var y = 6.5
y.round(.up)
// y == 7.0
// Equivalent to the C 'floor' function:
var z = 6.5
z.round(.down)
// z == 6.0