として設定されている場合でも、状態を停止しません:Booleanこのコードでは偽
The current crop is : FBRflx
Checking minimum Temperatures...
x.all_crop_parameters_match_the_PRA_ones = False
Checking the Water Resources...
Verifying if the Water Resources match with the Tmin supported by the crop...
x.all_crop_parameters_match_the_PRA_ones = False
The soil pH of this PRA matches to the crop requirements.
This crop is edible for the current PRA !
プログラムの開発は、そのXを参照してくださいなぜ私は理解していない:私は次のような結果を得る
for crop in database:
print("The current crop is :", crop)
x.all_crop_parameters_match_the_PRA_ones = True
while x.all_crop_parameters_match_the_PRA_ones :
ASSESS_Tmin(crop, x, PRA)
print("x.all_crop_parameters_match_the_PRA_ones = ", x.all_crop_parameters_match_the_PRA_ones)
ASSESS_Water(crop, PRA, x)
print("x.all_crop_parameters_match_the_PRA_ones = ", x.all_crop_parameters_match_the_PRA_ones)
ASSESS_pH(crop, PRA, x)
を。 all_crop_parameters_match_the_PRA_onesはFalseであり、ループを解除して次のトリミングに切り替える代わりに、次の機能を実行します。
x私が使用しているすべての変数を含むクラスであり、変更することは自分のコードのいくつかの機能です。ブール値はクラスから来ているため、エラーになることはありますか?
それが唯一の次のループでのを止める...あなたはそれが途中で実行を停止しますか中にコード?それを打ち破るために明示的な 'break'を置かなければなりません...あなたが投稿した内容は期待された振る舞いのように見えます。 – DSLima90