我查看了几部莎士比亚的文件,但我无法弄清楚如何使我的莎士比亚计划有效。
我尝试了以下内容:
Shakespeare, A Program.
Romeo, A young man.
Juliet, a young woman
Act I: A test of variables.
Scene I: The first scene.
[Enter Romeo and Juliet]
Hamlet: You are as stupid as a smelly big flower!
(这应该将朱丽叶设为4,因为臭臭= * 2,大= * 2,花= 1)
Juliet: Proceed to Scene II.
[Exeunt]
Scene I: The second scene.
[Enter Romeo and Juliet]
Juliet: Am I better than you?
Romeo: If so, you are as intelligent as the square root of Juliet.
Romeo: Open your heart.
这应该返回2,这是朱丽叶的价值。不幸的是,这只会给编译器错误。我做错了什么?
答案 0 :(得分:11)
一开始,你只定义了罗密欧与朱丽叶,并且有2个场景我。我认为你打算做的是
Shakespeare, A Program.
Romeo, A young man.
Juliet, a young woman.
Act I: A test of variables.
Scene I: The first scene.
[Enter Romeo and Juliet]
Romeo: <<This is important, because Hamlet is not defined!
You are as stupid as a smelly big flower!
Juliet: Proceed to Scene II.
[Exeunt]
Scene II: The second scene. <<You need to change it to Scene II!
[Enter Romeo and Juliet]
Juliet: Am I better than you?
Romeo: If so, you are as intelligent as the square root of Juliet.
Romeo: Open your heart.
[Exeunt]
这应该返回2。
答案 1 :(得分:1)
此外,如果所有字符将被带回下一个场景,编译器通常不会将所有字符都放在场景的末尾。此外,“进入场景2不是必要的(但它是有帮助的)。 例如
Juliet: Proceed to Scene II
Scene II: The second scene.
....