【问题标题】:Android Pattern Logic [closed]Android模式逻辑[关闭]
【发布时间】:2022-11-23 03:02:27
【问题描述】:

enter image description here

任何人都可以向我解释这个逻辑。

这里我得到的答案是我想要的实际答案,但我想知道这种模式背后的正确工作流程。

谢谢

【问题讨论】:

标签: android


【解决方案1】:
 Your for loop will run for 10 times from 0-9.
then inside your for loop you inserted the color.
then your if condition states that when there is even place print white 
else black.(i%2==0 means even)

【讨论】:

  • 请检查结果先生。我得到了 ("black", "white", "white", "black") 而不是 ("black", "white","black", "white") 所以我想了解它是如何工作的
【解决方案2】:
if (i%2==0)
{
    print"Black"
} else { 
    print"White"
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-15
    • 1970-01-01
    • 1970-01-01
    • 2016-06-23
    • 1970-01-01
    相关资源
    最近更新 更多