In Remembrance of King Bhumibol Adulyadej
5 December 1927 – 13 October 2017

การสร้างฟังชั่น (Function)

func ประกาศ ฟังชั่น ตามด้วยชื่อของฟังชั่น และตัวอาร์กูเมนต์

ใช้เครื่องหมาย -> ในการบอกชนิดของ return และค่าของรีเทริน์

ตัวอย่าง

  1. func Hello(name:String) -> String{

  2. return "Sawasdee Ka (name)“ }

  1. Hello("David”)


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Don`t copy text!