| |
Simplest SKILL Data
The simplest SKILL expression is a data item. SKILL data is case sensitive. You can enter data in many familiar ways, including the following.
最简单的SKILL表达式是数据项。SKILL数据区分大小写。您可以通过许多熟悉的方式输入数据,包括以下方式。
integer 5
floating point 5.3
text string "Mary had a little lamb"
Calling a Function
Function names are case sensitive. To call a function, state its name and arguments in a pair
of parentheses.
函数名区分大小写。要调用一个函数,需在一对括号内说明函数名和参数。
parentheses /pəˈrɛnθɪsiːz/ 括号
case sensitive 区分大小写
strcat("Mary" " had" " a") ==> "Mary had a"
strcat('ab "xyz") ==>"abxyz"
strcat("ab" "xyz" upw") ==>"abxyzwpw"
1) No spaces are allowed between the function name and the left parenthesis.
函数名和左圆括号之间不允许有空格。
2)Several function calls can be on a single line. Use spaces to separate them.
多个函数调用可以在一行上。使用空格来分隔它们
3)You can span multiple lines in the command line or a source code file.
您可以在命令行或源代码文件中使用多行
strcat(
"ab" "xyz" "upw"
"and"
)
==>"abxyzupwand"
4)When you enter several function calls on a single line, the system only displays the return result from the final function call.
当您在一行上输入多个函数调用时,系统只会显示最后一个函数调用的返回结果。
final 最终的;最后的
several function calls
on a single line 在一行上
Operators Are SKILL Functions 运算符是SKILL函数。
SKILL provides many operators. Each operator corresponds to a SKILL function. Here are some examples of useful operators:
SKILL提供了许多运算符。每个运算符都对应一个SKILL函数。以下是一些常用运算符的示例:
The following example shows several function calls using operators on a single line. The calls are separated by spaces. The system displays the return result from the final function call.
下面的示例展示了在单行上使用运算符进行多个函数调用。各个调用之间用空格分隔。系统会显示最后一个函数调用的返回结果。
x=5 y=6 x=y
==》11 ;系统会显示最后一个函数调用的返回结果
Using Variables
You do not need to declare variables in SKILL. SKILL creates a variable the first time it encounters the variable in a session. Variable names can contain
在SKILL中,您无需声明变量。SKILL会在会话中首次遇到变量时创建一个变量。变量名可以包含 。
declare /dɪˈkleə(r)/ v 声明;宣布;宣告;宣称
encounter /ɪnˈkaʊntə(r)/ 遭遇;遇到
Alphanumeric /ˌælfənjuːˈmerɪk/ 字母数字;字母数字的
1) Alphanumeric characters 字母数字字符
2) Underscores ( _ ) 下划线
3) Question marks 问号
The first character of a variable cannot be a digit. Use the assignment operator to store a value in a variable. You enter the variable name to retrieve its value. The type SKILL function returns the data type of the variable’s current value.
变量的第一个字符不能是数字。使用赋值运算符将值存储在变量中。输入变量名称以检索其值。类型函数SKILL返回变量当前值的数据类型。
the assignment operator 赋值运算符
retrieve /rɪˈtriːv/ vt 检索;取回;找回;挽回;索回;
x='(a b c)
type(x) ==> list
x=5
type(x) ==>fixnum
Alternative Ways to Invoke a Function 调用函数的其他方法。
In addition to calling a function by stating its name and arguments in a pair of parentheses, as shown below, you can use two other syntax forms to invoke SKILL functions.
除了在括号中指定函数名称和参数以调用函数之外,还有两种其他语法形式可用于调用SKILL函数。
strcat("I" " am" " a" " student")
==> "I am a student"
1) You can place the left parenthesis to the left of the function name (Lisp syntax).
在Lisp语法中,你可以将左括号放置在函数名的左侧。
(strcat "I" " am" " a" " student")
==> "I am a student"
2) You can omit the outermost levels of parenthesis if the SKILL function is the first element at your SKILL prompt, that is, at the top level.
如果你在SKILL提示符中的第一个元素是SKILL函数,也就是说,在顶层,你可以省略最外层的括号。
strcat "I" " am" " a" " student"
==> "I am a student"
You can use all three syntax forms together. In programming, it is best to be consistent. Cadence recommends the first style noted above. 你可以同时使用这三种语法形式。在编程中,保持一致性是最好的做法。Cadence推荐使用上面提到的第一种风格。
Alternative /ɔːlˈtɜːnətɪv/ adj 可供替代的;另类的;非传统的
parenthesis /pəˈrenθəsɪs/ 圆括号
omit /əˈmɪt/ v 省略;忽略;遗漏;漏掉;删除;
syntax /ˈsɪntæks/ n 句法;句法规则;语构
consistent /kənˈsɪstənt/ adj 一致的;始终如一的;连续的;持续的;