本文介绍了关于功能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我试试吧: def b(): ... a() ... def a(): ... b() ... b() 它不起作用。 是否有可能预售 - 在c ++中定义函数或者在主块之后放置函数代码 ? int a(); int b( ); int main() { .... a(); .... } int a() { .... b(); .... } int b() { .... a(); .... } =)抱歉我的英文;) 解决方案 它的工作原理。 def a(): print" a" b() def b(): 打印" b" 打印#不打电话! b() 但如果你真的打电话给b,你会创建一个无限循环。在所有 编程语言中,顺便说一句。 No. 是。 确实如此。请发布完整的代码和错误消息,其他内容 错误,不是循环引用。 George 你不工作是什么意思?在调用`b()`时,两个 函数都被定义,所以它应该工作。或者至少它不是你认为的那个问题。上面的代码,点都没有替换, 当然会永远地运行。直到达到堆栈限制。 Ciao, Marc''BlackJack''Rintsch I try it:def b():...a()...def a():...b()...b()it''s not work.Is it possible pre-define function like in c++ or place functions codeafter main block?int a();int b();int main (){....a();....}int a(){....b();....}int b(){....a();....}=) sorry for my eng;) 解决方案It works.def a():print "a"b()def b():print "b"print a # not calling!b()But if you really call a in b, you create an endless loop. In allprogramming languages, btw.No.Yes.It sure does. Please post full code and error message, something elseis wrong, not the cyclic reference.GeorgeWhat do you mean by not working? At the time `b()` is called, bothfunctions are defined so it should working. Or at least it''s not theproblem you think it is. The code above, the dots replaced with nothing,will of course run "forever" until the stack limit is reached.Ciao,Marc ''BlackJack'' Rintsch 这篇关于关于功能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 12:39