add asciicast
This commit is contained in:
parent
69b3681697
commit
b319e29be8
|
@ -49,6 +49,10 @@ $ sed -u "s|#.*||" | sed -u 's|M|000000|g' | go run f.go
|
|||
# ^ piano tuners in Chicago
|
||||
```
|
||||
|
||||
You can see a recording in action here:
|
||||
|
||||
[![asciicast](https://asciinema.org/a/fygBtg0XDc1iVajArdQn9b9CA.svg)](https://asciinema.org/a/fygBtg0XDc1iVajArdQn9b9CA)
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
|
|
26
f.go
26
f.go
|
@ -46,22 +46,38 @@ func main() {
|
|||
var old_low, old_high float64
|
||||
var input string
|
||||
var err1, err2 error
|
||||
|
||||
InitialForLoop:
|
||||
for {
|
||||
input, _ = reader.ReadString('\n')
|
||||
input = strings.TrimSpace(input)
|
||||
words := strings.Split(input, " ")
|
||||
if len(words) != 2 {
|
||||
|
||||
switch len(words) {
|
||||
case 1:
|
||||
single_float, err1 := strconv.ParseFloat(words[0], 64)
|
||||
if err1 != nil {
|
||||
fmt.Println("Trying to initialize with a scalar, but scalar is not a float")
|
||||
continue InitialForLoop
|
||||
}
|
||||
old_low = single_float
|
||||
old_high = single_float
|
||||
case 2:
|
||||
old_low, err1 = strconv.ParseFloat(words[0], 64)
|
||||
old_high, err2 = strconv.ParseFloat(words[1], 64)
|
||||
if err1 != nil || err2 != nil {
|
||||
fmt.Println("Trying to initialize with a distribution, but distribution is not specified as two floats")
|
||||
continue InitialForLoop
|
||||
}
|
||||
default:
|
||||
fmt.Println("Please enter two floats separated by a space, like: 1 10")
|
||||
continue
|
||||
continue InitialForLoop
|
||||
}
|
||||
old_low, err1 = strconv.ParseFloat(words[0], 64)
|
||||
old_high, err2 = strconv.ParseFloat(words[1], 64)
|
||||
if err1 != nil || err2 != nil {
|
||||
fmt.Println("Please enter two floats separated by a space, like: 1 10")
|
||||
continue
|
||||
}
|
||||
break
|
||||
|
||||
}
|
||||
fmt.Printf("=> %.1f %.1f\n", old_low, old_high)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user