Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -0,0 +1,10 @@
|
|||
$method = ([Math] | Get-Member -MemberType Method -Static | Where-Object {$_.Definition.Split(',').Count -eq 1} | Get-Random).Name
|
||||
$number = (1..9 | Get-Random) / 10
|
||||
$result = [Math]::$method($number)
|
||||
$output = [PSCustomObject]@{
|
||||
Method = $method
|
||||
Number = $number
|
||||
Result = $result
|
||||
}
|
||||
|
||||
$output | Format-List
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import os
|
||||
|
||||
struct Obj {
|
||||
mut:
|
||||
methods map[string]fn()
|
||||
}
|
||||
|
||||
fn (mut o Obj) create_methods() Obj {
|
||||
o.methods["ma"] = fn () { println("Method A Called") }
|
||||
o.methods["mb"] = fn () { println("Method B Called") }
|
||||
o.methods["mc"] = fn () { println("Method C Called") }
|
||||
return o
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut obj := Obj{}
|
||||
obj = obj.create_methods()
|
||||
name := os.input("Which method should I call? ").str()
|
||||
if name in obj.methods { obj.methods[name]() }
|
||||
else { println("No method of that name found!") }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue