これをどう説明すればよいのか正確にはわかりませんが、これを行う方法があると確信していますが、まだ理解していません。これが私の例です: 10 個の変数 (整数値) があり、変数の値で文字列が設定されます。
以下は、天候と雲量を使用して気象条件を判断する例です。
if (hour1cloud <= 5) {
hour1weather = @"Clear";
}
if (5 < hour1cloud <= 25) {
hour1weather = @"Mostly Clear";
}
if (25 < hour1cloud <= 50) {
hour1weather = @"Partly Cloudy";
}
if (50 < hour1cloud <= 83) {
hour1weather = @"Mostly Cloudy";
}
if (83 < hour1cloud <= 105) {
hour1weather = @"Overcast";
}
hour2weather、hour3weather などに対応する hour2cloud、hour3cloud、hour4cloud などがあるとします。hour1cloud を入力して hour1weather を取得するユニバーサル メソッドを作成する方法はありますか?