Perhaps surprisingly, you're going to run into a very similar issue when you
compare strings. Check out this code. I have two strings, Uda and city. I
concatenated the two together, to form a string that are called firstAndSecond.
And over here I have a third string, Udacity. And now I check wether, the first
and second which we would expect to be Udacity, is the same as, Udacity. And if
so this program prints, they are the same, otherwise it prints what
firstAndSecond is. Again, go ahead and run this program yourself and tell me
what you find. Just put your output into this box.
Quizás te sorprenda que vas a tener un problema muy similar al
comparar cadenas. Echa un vistazo a este código. Tengo dos cadenas, Uda y city. Hice
una concatenación de los dos para formar una cadena que se llama firstAndSecond (primeroYSegundo).
Y aquí tengo una tercera cadena, Udacity. Y ahora puedo comprobar si la primera
y segunda, que esperaríamos sería Udacity, es lo mismo que Udacity. Y si
es así, este programa imprime, Son lo mismo; de lo contrario, imprime lo que
es firstAndSecond. Una vez más, sigue adelante y ejecuta este programa tú mismo y dime
lo que encuentres. Sólo pon tu resultado en este cuadro.
Chose étonnante peut-être, vous allez
rencontrer un problème similaire
en comparant les chaînes.
Regardez ce code.
J'ai deux châines, Uda et city.
J'ai concaténé les deux pour former
une chaîne appellée firstAndSecond.
Ici, j'ai une troisième chaîne, Udacity.
Et maintenant je vérifie si
firstAndSecond,
dont on espère que ce sera Udacity,
soit la même que Udacity.
Et si oui, ce programme imprime,
They are the same,
sinon il imprime ce que sont
la première et la seconde.
Encore une fois, exécutez
ce programme vous-même
et dites-moi ce que vous obtenez.
Mettez simplement votre
sortie dans cette case.
文字列を比較する時にも似た問題が発生します
このコードを見てください
Udaとcityの2列です
firstAndSecondと呼ばれる文字列を作るために
それら2つを連結します
そしてここに3番目の文字列があります
Udacityです
最初の2列を連結したものが
このUdacityと同じになるかチェックします
同じならThey are the sameと表示し
違う場合はfirstAndSecondの値を表示します
ではプログラムを実行してみて
その結果をこのボックスに書いてください
문자열을 비교할 때 소수와 비슷한 오류를 범하게 될 겁니다.
이 코드를 보세요. Uda와 City를 갖고 있는 두 문자열이 있습니다.
그 다음에 둘이 합친 값인 firstAndSecond를 선언했습니다.
여기는 세 번째 문자열이 있습니다. 이제 두 개의
값이 같은지 비교해 봅시다. 둘이 같다면
'They're the same'을 출력하고 같지 않다면 firstAndSecond를
출력합니다. 여러분이 이 프로그램을 실행해보고
어떤 결과가 나타나는지 이 박스 안에 넣어 주세요.
Thật ngạc nhiên, bạn sẽ gặp phải một trường hợp tương tự khi bạn so sánh chuỗi
Kiểm tra đoạn code này, tôi có 2 chuỗi Uda và city.
Tôi nối 2 chuỗi lại với nhau để tạo ra một chuỗi mới gọi là firstAndSecond.
Và ở đây tôi có một chuỗi thứ 3 "Udacity". Và bây giờ chúng tôi kiểm tra firstAndSecond.
Nếu nó giống hệt chuỗi third, tức là chuỗi Udacity
chương trình sẽ in ra "They are the same", ngược lại nó in ra firstAndSecond is .
Một lần nữa, hãy chạy chương trình và nói cho tôi biết bạn thấy gì
viết câu trả lời của bạn vào ô trống.