-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Phelps
committed
Jun 30, 2021
1 parent
32e3c0d
commit 885572e
Showing
6 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
fmt.Println(func() string { | ||
b, err := json.Marshal(1) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return string(b) | ||
}()) | ||
fmt.Println(func() string { | ||
b, err := json.Marshal("hello") | ||
if err != nil { | ||
panic(err) | ||
} | ||
return string(b) | ||
}()) | ||
c := func() string { | ||
b, err := json.Marshal(map[string]interface{}{"hello": 1, "how": "are you"}) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return string(b) | ||
}() | ||
fmt.Println(c + c) | ||
fmt.Println(func() string { | ||
b, err := json.Marshal([]int{1, 2, 3}) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return string(b) | ||
}()) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import json | ||
import random | ||
|
||
|
||
def main(): | ||
print(json.dumps(1)) | ||
print(json.dumps("hello")) | ||
c = json.dumps({"hello": 1, "how": "are you"}) | ||
print(c + c) | ||
print(json.dumps([1, 2, 3])) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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
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
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