Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

Swift Overloading with Different Parameter Types

// function with Int type parameter
func displayValue(value: Int) {
    print("Integer value:", value)
}

// function with String type parameter
func displayValue(value: String) {
    print("String value:", value)
}

// function call with String type parameter
displayValue(value: "Swift")

// function call with Int type parameter
displayValue(value: 2)
Comment

PREVIOUS NEXT
Code Example
Swift :: swift apply changes after a word in string 
Swift :: Swift Change Value of a Variable 
Swift :: swift 5 flatMap wtih keypath 
Swift :: Swift Access Struct Properties Swift 
Swift :: Swift continue with while loop 
Swift :: UIApplicationWillEnterForeground 
Swift :: Save and Load Data From Keychain ios swift 
Swift :: uitableview total number of rows 
Swift :: Swift Nested Function with Parameters 
Swift :: swift api call with certificate 
Swift :: list header swiftui 
Swift :: swift memberwise initializer 
Swift :: disable trailing swipe action swift 
Swift :: Swift Explicitly declaring an unwrapped optional 
Swift :: swift uknow attrubute main 
Swift :: view rounded corners swift 
Swift :: corner radius with animation swift 
Swift :: Swift repeat...while Loop 
Swift :: How to make dart typing stricter 
Swift :: string to decimal swift 
Ruby :: rails get list of tables 
Ruby :: ruby string to date 
Ruby :: rspec check if object of a class 
Ruby :: ruby delete folder recursively 
Ruby :: Your Ruby version is 3.0.0, but your Gemfile specified 2.7.4 
Ruby :: rails datatypes 
Ruby :: add column with default value in rails 
Ruby :: shopify: how to show percentage discount saved 
Ruby :: ruby class 
Ruby :: rails secure uuid 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =