السلاسل والنصوص
خزّن قيم النصوص وادمجها
السلاسل والنصوص درس مجاني في Mojo Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Mojo Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Mojo Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Text Is a String
Any sequence of characters, like a name or a message, is a String. It is how programs hold human-readable text. 💬
Make a String
Wrap text in double quotes to create a String, then store it in a var so you can reuse the text later.
var name = "Ada"Single or Double Quotes
Mojo accepts both quote styles. Pick the one that lets your text stay clean, like single quotes around a phrase with a quote inside.
var word = 'hello'Joining Text with +
Put two Strings together using +. This is called concatenation and it builds a longer string from pieces.
var greeting = "Hi, " + nameMind the Spaces
Concatenation glues text exactly as written. Add a space inside a String so words do not collide when joined.
var full = "Ada" + " " + "Lovelace"Printing Text
print sends a String to the screen. It is your quickest way to see what a String currently holds.
print("Hello, world")Empty and Long Strings
A String can be empty ("") or hold a whole sentence. Length is up to you; the type stays the same either way.
var blank = ""Numbers Are Not Text
"42" is a String, while 42 is an Int. They look alike but behave differently, so keep text and numbers distinct.
var label = "42"Turning a Number into Text
To join a number into a message, convert it with String first so the + has two strings to combine.
var msg = "Score: " + String(score)Strings Describe Your Program
Labels, prompts, and messages are all Strings. Clear text makes your output friendly for the person reading it.
Text Powers Communication
From greetings to error messages, Strings carry meaning to users. Mastering text is half of writing useful programs.
Quick Check
You have a number in score and want to put it inside a text message. What do you do first?
Recap
A String holds text in quotes, joins with +, and prints to the screen. Convert numbers to String before mixing them in. 🎯
الأسئلة الشائعة
هل درس «السلاسل والنصوص» مجاني؟
نعم — نص درس «السلاسل والنصوص» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Mojo Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Mojo Academy 4 دروس في المجموع.
ماذا ستتعلم في «السلاسل والنصوص»؟
خزّن قيم النصوص وادمجها تتمرن على Mojo Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Mojo Academy؟
لا تُشترط خبرة سابقة. Mojo Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.
كم من الوقت يستغرق درس «السلاسل والنصوص»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Mojo Academy هذا؟
نعم. كل درس في Mojo Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.