据我了解,let定义了一个引用,可以将其视为别名,因此例如let x = y * y * y不计算y * y * y但出现的x将被替换y * y * y。局部变量与其他语言的局部变量类似。
如https://www.cairo-lang.org/docs/hello_cairo/dict.html中所示,写是什么意思let (local dict_start : DictAccess*) = alloc()?每个 的实例local dict_start : DictAccess*都会被替换为alloc()? 为什么不只是local (dict_start : DictAccess*) = alloc()或let (dict_start : DictAccess*) = alloc()?
我想翻译一下:
foreach(Control c in Controls)
{
if(c is TextBox)
{
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
成:
foreach(Control c => (c is TextBox) in Controls)
{
// ...
}
Run Code Online (Sandbox Code Playgroud)
如何使用lambda函数专门完成?