강의

멘토링

커뮤니티

Inflearn Community Q&A

soy53560490's profile image
soy53560490

asked

[MMORPG Game Development Series with C# and Unity] Part 1: Introduction to Basic C# Programming

while

do-while 문에서 while() 조건에 복수 조건을 설정하려면 어떻게 해야하나요?

Resolved

Written on

·

1.1K

0

예를 들어 게임 내에서나 텍스트로 정답을 입력하였을 때,

Y 대신 y나 yes, YES 등의 답변을 하는 유저가 있다고 가정할 경우

do-while문에서 복수 조건 설정이 가능한지 궁금합니다!

do

            {

                Console.WriteLine("저는 귀여운가요? (Y/N)");

                answer = Console.ReadLine();

            } while (answer != "Y");

            Console.WriteLine("정답입니다!");

C#

Answer 2

0

soy53560490님의 프로필 이미지
soy53560490
Questioner

아... answer != "Y" || "y" 로 해서 오류가 났었나 봅니다..ㅜㅜ

빠른 답변 감사합니다 선생님!

0

Rookiss님의 프로필 이미지
Rookiss
Instructor

조건부에 answer != "Y" || answer != "YES"
와 같이 or로 이어주시면 됩니다!

soy53560490's profile image
soy53560490

asked

Ask a question