coin: wrap an if statement
This commit is contained in:
parent
5bedd3918c
commit
e8ddf5e58c
@ -97,7 +97,11 @@ while {[gets stdin line] != -1} {
|
||||
set input [string range $input [string length $prefix] end]
|
||||
|
||||
if {$input == "coin"} {
|
||||
if {rand() < 0.5} { pmrespond "Heads." } else { pmrespond "Tails." }
|
||||
if {rand() < 0.5} {
|
||||
pmrespond "Heads."
|
||||
} else {
|
||||
pmrespond "Tails."
|
||||
}
|
||||
} elseif {[regexp {^dice( +|$)(.*)} $input -> _ args]} {
|
||||
if {! [string is integer -strict $args] || $args <= 0} {
|
||||
pmrespond "Invalid or missing number."
|
||||
|
Loading…
Reference in New Issue
Block a user