Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

fizzbuzz in swift

//Hacking with swift
func fizzbuzz(number: Int) -> String {
    switch (number % 3 == 0, number % 5 == 0) {
    case (true, false):
        return "Fizz"
    case (false, true):
        return "Buzz"
    case (true, true):
        return "FizzBuzz"
    case (false, false):
        return String(number)
    }
}

print(fizzbuzz(number: 15))
Comment

PREVIOUS NEXT
Code Example
Swift :: loop key value swift 
Swift :: swift substring 
Swift :: swift programming language wikipedia 
Swift :: how to get rid of excess space in swift 
Swift :: swift push view controller 
Swift :: swift constraint center vertically 
Swift :: prevent iphone to sleep swift 
Swift :: how to get current shown collectionview cell index in swift 
Swift :: swift ways to setup constraints 
Swift :: swiftui rectangle color 
Swift :: swift 5 only the day number from date 
Swift :: swift dismiss keyboard on return 
Swift :: sort array alphabetically swift 4 
Swift :: convert int to string in swift 
Swift :: Module compiled with Swift 5.3 cannot be imported by the Swift 5.3.1 compiler 
Swift :: Swift Swift continue statement with nested loops 
Swift :: swift edit constraint programmatically 
Swift :: concatenate string swift 
Swift :: user defaults swift 
Swift :: how to get the path of selected PDF/doc from file manager in ios swift programmatically 
Swift :: how to recieve hex value from NSData swift 
Swift :: did select row at 
Swift :: swift enum storyboard 
Swift :: Swift Named Tuples 
Swift :: Swift Add Two Numbers 
Swift :: swiftui divider remove padding 
Swift :: Swfit Add Elements to an Array 
Swift :: swift looping through array 
Swift :: convert meter to miles swift 
Swift :: Swift Benefits of Using Functions 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =