-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboolean-operator.go
44 lines (34 loc) · 961 Bytes
/
boolean-operator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import "fmt"
func main() {
// Boolean Operation
// && (Dan)
// || (Atau)
//! (Kebalikan)
// && Operation
// Nilai 1 | Operator | Nilai 2 | Hasil |
// true | && | true | true |
// true | && | false | false |
// false | && | true | false |
// false | && | false | false |
// || Operation
// Nilai 1 | Operator | Nilai 2 | Hasil |
// true | || | true | true |
// true | || | false | true |
// false | || | true | true |
// false | || | false | false |
// ! Operation
// Operator | Nilai 2 | Hasil |
// ! | true | false |
// ! | false | true |
var nilaiAkhir = 90
var absensi = 80
var lulusNilaiAkhir = nilaiAkhir > 80
var lulusAbsensi = absensi > 80
fmt.Println(lulusNilaiAkhir)
fmt.Println(lulusAbsensi)
var lulus = lulusNilaiAkhir && lulusAbsensi
fmt.Println(lulus)
// OR To the Point
fmt.Println(nilaiAkhir > 80 && absensi > 80)
}