Go 言語でも (a==1 && a==2 && a==3) を true にしてみたい(クソリプ編) ref: https://qiita.com/spiegel-im-spiegel/items/16b15d0c646e2a0e3e7d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
my $a = 1; | |
my @a = (1, 2); | |
sub a { 3 }; | |
if ($a == 1 and @a == 2 and &a == 3) { | |
print "True!\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
a := make(chan int) | |
go func() { | |
for i := 1; ; i++ { | |
a <- i | |
i %= 3 | |
} | |
}() | |
if <-a == 1 && <-a == 2 && <-a == 3 { | |
fmt.Println("True!") | |
} | |
if <-a == 1 && <-a == 2 && <-a == 3 { | |
fmt.Println("True!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment