Tag: variables

如何使用内联variables创build多行Pythonstring?

我正在寻找一种干净的方式来使用多行Pythonstring中的variables。 说我想做以下事情: string1 = go string2 = now string3 = great """ I will $string1 there I will go $string2 $string3 """ 我正在查看Perl中是否有类似于$的元素来表示Python语法中的variables。 如果不是 – 用variables创build多行string的最简洁的方法是什么?

为什么不让C#使用var声明多个variables?

鉴于以下情况: // not a problem int i = 2, j = 3; 所以这令我感到惊讶: // compiler error: Implicitly-typed local variables cannot have multiple declarators var i = 2, j = 3; 不编译。 也许有什么我不明白这个(这就是为什么我问这个)? 但为什么编译器不知道我的意思是: var i = 2; var j = 3; 这将编译。

如何在batch file中持久地设置Windows 7中的variables?

我试图在Windows 7中使用bat文件设置PATH环境variables; 但它似乎并没有工作。 我正在使用这个Windows命令: set PATH=%cd%;%path% pause 但是,它似乎只适用于此cmd实例。 我希望它是永久的,因为我第一次设置path,然后运行一个程序,需要find该文件夹​​中的库。

使用包含常量名称的简单variables访问类常量

我想在我的一个类中访问类常量: const MY_CONST = "value"; 如果我有一个variables,它包含这个常量的名字,如下所示: $myVar = "MY_CONST"; 我可以以某种方式访问​​MY_CONST的值吗? self::$myVar 不明显,因为它是静态属性。 variablesvariables也不起作用。

无法在Mac OSX上设置$ GOPATH

我想设置我的$GOPATHvariables来运行我的机器上的一些示例代码: $ smitego-example go run main.go main.go:5:2: cannot find package "github.com/#GITHUB_USERNAME#/smitego" in any of: /usr/local/go/src/pkg/github.com/#GITHUB_USERNAME#/smitego (from $GOROOT) ($GOPATH not set) $ smitego-example export $GOPATH=$HOME -bash: export: `=/Users/#OSX_USERNAME#': not a valid identifier github.com/#GITHUB_USERNAME#/smitego/smitego.go内容: package smitego 我怎样才能设置我的GOPATH ,使其始终如一地工作?

javascript:定义一个variables,如果它不存在

我觉得我试图做一些非常简单的事情,但只是愚蠢的。 我想要做的就是看一个variables是否已经被设置,如果它没有,设置它的默认值….这里是一个示例: if(!embed_BackgroundColor) { var embed_BackgroundColor; embed_BackgroundColor = "#F4F4F4"; } 所以,一旦你停止嘲笑我的代码….为什么它覆盖variables不pipe是什么? 请救我的神经;)

枚举variables的默认值?

问题很简单: #include <iostream> enum SomeEnum { EValue1 = 1, EValue2 = 4 }; int main() { SomeEnum enummy; std::cout << (int)enummy; } 输出是什么? 注:这不是一个采访,这是我从以前的开发人员inheritance的代码。 这里的stream操作符只是例子,实际的inheritance代码没有它。

常量或类variables在ruby?

我已经使用Ruby进行了几个月的编程,而且我想知道何时使用常量来超越类variables,反之亦然。 (我在Rails中工作,思考模型中的常量)。 class Category TYPES = %w(listing event business).freeze end 要么 class Category @@types = %w(listing event business).freeze cattr_reader :types end 有一种情况比另一种更可取? 还是仅仅是品味/风格的问题?

x86汇编 – 使用哪个可变大小(db,dw,dd)

我是一个初学者,我不知道db,dw,dd是什么意思。 我试图写这个1 + 1的小脚本,将它存储在一个variables中,然后显示结果。 这是我的代码到目前为止: .386 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib .data num db ? ; set variable . Here is where I don't know what data type to use. .code start: mov eax, 1 ; add 1 to eax register mov ebx, 1 […]

我如何在XAML中定义一个variables?

我在XAML中有以下两个button: <Button Content="Previous" Margin="10,0,0,10"/> <Button Content="Next" Margin="0,0,10,10"/> 我如何定义“10”是一个variables,所以我可以在一个地方改变它,像这样: PSEUDO CODE: <variable x:key="theMargin"/> <Button Content="Previous" Margin="{Variable theMargin},0,0,{Variable theMargin}"/> <Button Content="Next" Margin="0,0,{Variable theMargin},{Variable theMargin}"/>