Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Go (golang) Tutorials - If and Switch Constructs

  • Ambasoft Java
  • 2018-03-16
  • 160
Go (golang) Tutorials - If and Switch Constructs
JavaGoOpen sourceProgrammingAlexaHTML5IoTRaspberry PInode.js
  • ok logo

Скачать Go (golang) Tutorials - If and Switch Constructs бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Go (golang) Tutorials - If and Switch Constructs или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Go (golang) Tutorials - If and Switch Constructs бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Go (golang) Tutorials - If and Switch Constructs

#golang #go #programming

If and switch constructs
---------
1. Basic If
2. Basic If with short statement (variable scope)
1. If statement can accommodate a short operative statement along with a conventional conditional statement
2. Short statement variables defined in if, will be accessible only within the scope of if..else construct
3. Basic Switch (break not needed)
Break statement is not needed, as every case will complete the switch construct when it gets executed
Switch statement can test a string,int,character,expressions,statements,etc, whereas in c,c++, it will support only constants that too int,float,char variables
4. Switch with short statement (variable scope)
Similar to If condition, we can include a short statement containing declaration or assignment for any switch test
5. Switch without a condition
-Empty switches should not contain any case statement. Default is the only permissible block inside empty switch
On seeing an empty switch the compiler will understand it as "switch true" and permists the execution to the default statment
-----------------------
Code
------

conditiondemo.go
------------------
package main
import "fmt"

func main(){

if a:=20; a==5 { //Declare or assign using short statement and condition
fmt.Printf("Value of a is %d and it is equal to 5\n",a)
} else {
fmt.Printf( "Value of a is %d and it is not equal to 5\n",a)
}
// fmt.Println(a) can't access the variable 'a' assigned in 'if' short statement outside the if..else construct
}


switchdemo.go
-------------
package main
import "fmt"

func main(){
switch name:="ghi";name { //Short statement with testing the variable "name"
case "abc":
fmt.Println("First three alphabets")
case "def":
fmt.Println("Second set of three alphabets")
default:
fmt.Println("Not belongs to first and second set of three alphabets")
}

switch { //Empty switch statement without any test variable - implicitly go will consider this empty switch as "switch true"
default :
fmt.Println("Empty switch default block")
}
}

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]