-5
스트라이크가 3에 도달했을 때 아웃을 높이려면 if 문을 쓸어 낼 수 없습니다. 누군가 임대 도움말을 할 수있는 누군가가 3 명 파업스위프트 Xcode 6 야구 카운터
//
// ViewController.swift
// helloWordDemo
//
// Created by Developer on 6/8/14.
// Copyright (c) 2014 AECApps. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBOutlet var labelDispaly : UILabel = nil
// dispaly Strikes
var counter = 1
@IBAction func buttonPressed(sender : AnyObject) {
labelDispaly.text = "Strikes \(counter++)"
}
//button to add strikes
@IBOutlet var OutsDispaly : UILabel = nil
var outsCounter = 1
//outs dispaly
@IBAction func outsButtonPressed(sender : AnyObject) {
OutsDispaly.text = "Outs \(outsCounter++)"
}
//button to add outs
if counter = 3 {
outsCounter ++
}
}
사용 == ''대신에 '='를 :) – Mohsen