Introduction to the Zig Programming Language


Course Number: PROG-116
Duration: 3 days (19.5 hours)
Format: Live, hands-on

Zig Programming Training Overview

Zig is a general-purpose programming language and toolchain for creating robust, optimal, and reusable software. Zig improves on C with its customized memory control, null reference protection, and required error handling. Unlike Rust, Zig allows low-level memory control with syntax and memory model features to help avoid memory leaks. Finally, it provides interoperability with existing C libraries.

This Zig Programming training course teaches attendees how to leverage Zig's data types, control flow structures, code organization, memory management, and more.

Location and Pricing

Accelebrate offers instructor-led enterprise training for groups of 3 or more online or at your site. Most Accelebrate classes can be flexibly scheduled for your group, including delivery in half-day segments across a week or set of weeks. To receive a customized proposal and price quote for private corporate training on-site or online, please contact us.

In addition, some courses are available as live, instructor-led training from one of our partners.

Objectives

  • Build and run Zig programs
  • Explore features unique to Zig that set it apart from other languages
  • Understand where Zig is a good choice for writing software
  • Work with the Zig toolchain
  • Explore how Zig can be used as a drop-in replacement for C
  • Discover how Zig enables performance and safety
  • Apply modern techniques for memory control, null reference handling, and error handling with a lower-level language.

Prerequisites

All students must have programming experience.

Outline

Expand All | Collapse All

Introduction
  • What is Zig?
  • What Problems Does Zig solve?
  • Zig Compared to C
  • Zig Compared to Other Languages
  • Zig Zen
Getting Started
  • Zig Toolchain
  • Hello, Zig!
  • Code and Debug with VSCode
  • Zig Standard Library
  • Zig Source Files
  • Cross Compilation
Language Features in Hello Zig
  • Importing from the Standard Library
  • Constants
  • Define a Public “main” Function
  • Try Statement
  • Error Union Types
  • String Interpolation
  • Comments
Zig Project Scaffolding
  • Create a New Executable Project
  • Create a New Library Project
  • Build and Run
  • Build and Test
Console Apps
  • Print Output to the Terminal
  • Format Specifiers
  • Anonymous Struct Literals
  • Capture Input from the Terminal
  • String Comparison
  • While Loop
  • Error Handling
Data Types
  • Integers
  • Floats
  • Arrays
  • Pointers
  • Slices
Data Structures
  • Struct
  • Enum
  • Union
Variables
  • Variable Name Rules
  • Container Level Variables
  • Compile-Time vs. Run-Time Variables
  • Local Variables
Control Flow
  • Expressions and Operators
  • While/For Loops
  • Break/Continue Statements
  • If Statement
  • Switch Statement
  • Try/Catch Statement
  • Defer/ErrDefer Statement
Functions
  • What is a Function?
  • Define a Function
  • Call a Function
  • Pass Parameters to a Function
  • Immutable vs Mutable Parameters
  • Importing Functions from Other Zig Code Files
Strings
  • UTF-8 Data Type
  • Character Arrays
  • Buffers
  • Print Formatted Strings
  • Capture Strings Console Input
  • String Copy
  • String Comparison
Memory Control
  • Memory Allocation Philosophy
  • Memory Control vs. Memory Safety
  • Choosing an Allocators
  • Heap Allocation Failure
  • Lifetime and Ownership
  • Optional and Optional Pointers
  • Null References
Program a Zig “Object”
  • Compared to C/C++/Python/JavaScript
  • Anonymous Structs
  • Anonymous Struct Literals
  • Data Fields
  • Constant Fields
  • Error Enums
  • Function Members
  • Function Patterns
  • Dynamic Memory Allocation
Testing
  • Zig’s built-in testing
  • What can be tested?
  • Assert Output with Expect
Conclusion

Training Materials

All Zig Programming training students receive comprehensive courseware.

Software Requirements

A complete, remote virtual environment is provided for training and is accessible via the Internet from any modern web browser.



Learn faster

Our live, instructor-led lectures are far more effective than pre-recorded classes

Satisfaction guarantee

If your team is not 100% satisfied with your training, we do what's necessary to make it right

Learn online from anywhere

Whether you are at home or in the office, we make learning interactive and engaging

Multiple Payment Options

We accept check, ACH/EFT, major credit cards, and most purchase orders



Recent Training Locations

Alabama

Birmingham

Huntsville

Montgomery

Alaska

Anchorage

Arizona

Phoenix

Tucson

Arkansas

Fayetteville

Little Rock

California

Los Angeles

Oakland

Orange County

Sacramento

San Diego

San Francisco

San Jose

Colorado

Boulder

Colorado Springs

Denver

Connecticut

Hartford

DC

Washington

Florida

Fort Lauderdale

Jacksonville

Miami

Orlando

Tampa

Georgia

Atlanta

Augusta

Savannah

Hawaii

Honolulu

Idaho

Boise

Illinois

Chicago

Indiana

Indianapolis

Iowa

Cedar Rapids

Des Moines

Kansas

Wichita

Kentucky

Lexington

Louisville

Louisiana

New Orleans

Maine

Portland

Maryland

Annapolis

Baltimore

Frederick

Hagerstown

Massachusetts

Boston

Cambridge

Springfield

Michigan

Ann Arbor

Detroit

Grand Rapids

Minnesota

Minneapolis

Saint Paul

Mississippi

Jackson

Missouri

Kansas City

St. Louis

Nebraska

Lincoln

Omaha

Nevada

Las Vegas

Reno

New Jersey

Princeton

New Mexico

Albuquerque

New York

Albany

Buffalo

New York City

White Plains

North Carolina

Charlotte

Durham

Raleigh

Ohio

Akron

Canton

Cincinnati

Cleveland

Columbus

Dayton

Oklahoma

Oklahoma City

Tulsa

Oregon

Portland

Pennsylvania

Philadelphia

Pittsburgh

Rhode Island

Providence

South Carolina

Charleston

Columbia

Greenville

Tennessee

Knoxville

Memphis

Nashville

Texas

Austin

Dallas

El Paso

Houston

San Antonio

Utah

Salt Lake City

Virginia

Alexandria

Arlington

Norfolk

Richmond

Washington

Seattle

Tacoma

West Virginia

Charleston

Wisconsin

Madison

Milwaukee

Alberta

Calgary

Edmonton

British Columbia

Vancouver

Manitoba

Winnipeg

Nova Scotia

Halifax

Ontario

Ottawa

Toronto

Quebec

Montreal

Puerto Rico

San Juan