طيباوي
عدد المساهمات : 98 نقاط : 282 تاريخ التسجيل : 28/04/2015 الموقع : http://delph.forumalgerie.net
| موضوع: اداة اختيار switch من نوع سلسلة حرفية في لغة جو Go الأحد يناير 17, 2021 3:33 pm | |
| اداة اختيار switch من نوع سلسلة حرفية في لغة جو Go اداة الاختيار switch يتم من خلالها اختيار واحد من مجموعة من الاخيارات - هنا يتم اختيار الخيار توtwo وهو الذي ادخلناه في البداية - الكود:
-
package main
import "fmt"
func main() { var sq string = "two" switch sq { case "one": fmt.Println("string is one") case "two": fmt.Println("string is two") case "three": fmt.Println("string is three") case "four": fmt.Println("string is four") default: fmt.Println("string is default:") }
fmt.Println("Hello") } }
| |
|