mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
Update 3.PikaScript标准开发流程.md
This commit is contained in:
parent
9947236e6e
commit
f25c61599e
@ -165,9 +165,9 @@ def set(argPath: str, val: any):
|
||||
# Math.py
|
||||
class Adder(TinyObj):
|
||||
def byInt(a:int, b:int)->int:
|
||||
pass
|
||||
pass
|
||||
def byFloat(a:float, b:float)->float:
|
||||
pass
|
||||
pass
|
||||
```
|
||||
|
||||
上面的一段代码中我们定义了`Adder`类,并添加了两个方法的声明,`byInt(a:int,b:int)->int`表示方法名为byInt,输入参数为`a`和`b`,`a`和`b`的类型都是`int`型,而返回值也是`int`型,返回值由`->int`来确定,这都是python的标准语法,是带类型声明的写法。
|
||||
@ -178,9 +178,9 @@ class Adder(TinyObj):
|
||||
# Math.py
|
||||
class Multiplier(TinyObj):
|
||||
def byInt(a:int, b:int)->int:
|
||||
pass
|
||||
pass
|
||||
def byFloat(a:float, b:float)->float:
|
||||
pass
|
||||
pass
|
||||
```
|
||||
到此类接口就编写完成了。我们在main.py中引入Math包,这样Pika预编译器就会去编译Math类包了。
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user