odin-lang / odin-lang.org

http://odin-lang.org
22 stars 81 forks source link

Overview example for switch ranges now throwing compilation warnings...easy update on Overview #144

Closed mahSource closed 12 months ago

mahSource commented 12 months ago

Under this header https://odin-lang.org/docs/overview/#switch-statement A switch statement can also use ranges like a range-based loop:

switch c {
case 'A'..'Z', 'a'..'z', '0'..'9':
    fmt.println("c is alphanumeric")
}

Compiler warning: Syntax Warning: '..' for ranges has now been deprecated, prefer '..='

Suggested update resulting in no warnings:

switch c {
    case 'A' ..= 'Z', 'a' ..= 'z', '0' ..= '9':
        fmt.println("c is alphanumeric")
    }
Kelimion commented 12 months ago

Closed via 1a2cb94b6c4050b2fcc7955f770f09af425ea921.

mahSource commented 12 months ago

Thank you!