Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

Swift guard Statement Inside a Function

// create a function
func checkOddEven() {
  var number = 23

  // use of guard statement
  guard number % 2 == 0 else {
    
    print("Odd Number")
    return
  }

  print("Even Number")
}

// function call
checkOddEven()
Comment

PREVIOUS NEXT
Code Example
Swift :: spacing in uitextfield 
Swift :: Swift Access Class Property using Objects 
Swift :: separator style swiftui list 
Swift :: Swift for vs while loop 
Swift :: ios swift local storage with icloud 
Swift :: swift string interpolation 
Swift :: how to print body moya swift 
Swift :: func collectionview 
Swift :: single word search swift 
Swift :: Swift Things to Remember About Swift Range 
Swift :: Allow user to import image 
Swift :: Nested Loops in Swift 
Swift :: Error with preview @FocusState SwiftUI 
Swift :: key path expression as functions ios swift 
Swift :: swift writing to ios logs 
Swift :: xcode enable a button after a text field is filled 
Swift :: swift modify dictionary 
Swift :: meu eclipse não gera a implementação do mapstruct 
Ruby :: 2 decimal places ruby 
Ruby :: ruby calculate execution time 
Ruby :: travis ci NameError: uninitialized constant SimpleCov 
Ruby :: rspec add support folder 
Ruby :: comment in ruby 
Ruby :: ruby connect database 
Ruby :: autoload lib directory rails 
Ruby :: how to create 2 dimensional array in ruby 
Ruby :: rails generate rake task 
Ruby :: ruby hash delete 
Ruby :: ruby hash loop 
Ruby :: infinite loop ruby 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =