如何将if语句放入for循环中?

时间:2019-04-04 08:29:10

标签: javascript for-loop if-statement

我想在循环的最后一个数字时更改 let loginManager = LoginManager() loginManager.logIn([ .publicProfile ], viewController: self) { loginResult in switch loginResult { case .failed(let error): print(error) case .cancelled: print("User cancelled login.") facebookButton?.layer.removeAllAnimations() // remove animation here case .success(let grantedPermissions, let declinedPermissions, let accessToken): print("Logged in!") } 的值。

我尝试了以下代码,但这似乎不起作用:

volgendecylinder

1 个答案:

答案 0 :(得分:-1)

for (i = 1; i < aantalDwars; i++) { 

    var geometry2 = new THREE.CylinderGeometry( dwarsDiameter * scale , dwarsDiameter * scale , lengte2*scale , 20 );
    var material2 = new THREE.MeshBasicMaterial( {color: 0xe4734f} );
    var cylinder2 = new THREE.Mesh( geometry2, material2 );
    cylinder2.userData.type = 'cylinder';

    scene.add( cylinder2 );
    if (i == aantalDwars-1){
    volgendeCylinder = ((lengte*scale)/2) + uitsteekLinks

    }

    cylinder2.position.set( ((lengte*scale)/2)+volgendeCylinder2, 1 , 0);
    volgendeCylinder2 -= (dwarsMaas*scale);
    cylinder2.rotation.x = Math.PI / 2;
}