Implemented boolean literals
This commit is contained in:
parent
1f0db51a95
commit
bf5110edd4
11 changed files with 69 additions and 13 deletions
|
@ -9,7 +9,7 @@ main() {
|
|||
return
|
||||
}
|
||||
|
||||
if isPrime(i) == 1 {
|
||||
if isPrime(i) {
|
||||
if i != 2 {
|
||||
io.out(" ")
|
||||
}
|
||||
|
@ -23,22 +23,22 @@ main() {
|
|||
|
||||
isPrime(x int) -> bool {
|
||||
if x == 2 {
|
||||
return 1
|
||||
return true
|
||||
}
|
||||
|
||||
if x % 2 == 0 {
|
||||
return 0
|
||||
return false
|
||||
}
|
||||
|
||||
i := 3
|
||||
|
||||
loop {
|
||||
if i * i > x {
|
||||
return 1
|
||||
return true
|
||||
}
|
||||
|
||||
if x % i == 0 {
|
||||
return 0
|
||||
return false
|
||||
}
|
||||
|
||||
i += 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue