Steam telepítése
belépés
|
nyelv
简体中文 (egyszerűsített kínai)
繁體中文 (hagyományos kínai)
日本語 (japán)
한국어 (koreai)
ไทย (thai)
Български (bolgár)
Čeština (cseh)
Dansk (dán)
Deutsch (német)
English (angol)
Español - España (spanyolországi spanyol)
Español - Latinoamérica (latin-amerikai spanyol)
Ελληνικά (görög)
Français (francia)
Italiano (olasz)
Bahasa Indonesia (indonéz)
Nederlands (holland)
Norsk (norvég)
Polski (lengyel)
Português (portugáliai portugál)
Português - Brasil (brazíliai portugál)
Română (román)
Русский (orosz)
Suomi (finn)
Svenska (svéd)
Türkçe (török)
Tiếng Việt (vietnámi)
Українська (ukrán)
Fordítási probléma jelentése
Very glad to hear it works!
For a little more detail on why it might not have worked with the second example and in-case It might be a little helpful to anyone:
The main issue is that the Else statement has to match the indentation since the code in-game is heavily inspired by python or rather, is pretty much python with the exception of not requiring the players to import libraries and such.
So the first example you've wrote match properly with only the move(North which should have closed parentheses since it's a function and functions parentheses have to be closed to tell it that those are the arguments you're giving it.
And in the second example, as stated a little earlier in this post, the indentations have to match since in Python, you don't have the luxury of using braces to tell the compiler or interpreter that the method, loop or condition statement is enclosed at a specified line.
So to make it at least possible to have multiple conditions, the indentations are what's used to determine the end of a condition statement.
For example:
One thing that some people might also do, when the conditions are small enough to fit nicely on a single line, is combine them on the same if statement's condition depending on whether you need anything to happen between the two condition check or not.
For example:
And another nice thing is like in your first example.
You can make your functions return True or False if you want such ability to determine if it worked when calling the function.
You can even have your if statement declare a variable directly within it by just writing one equal sign instead of two. (If I recall though you might need to then put that declaration into parentheses so that it's counted as one boolean comparison.
Alright, I'll stop there for the time being since I could probably easily keep going and most likely repeat the same thing a few more times instead of sleeping without noticing haha.
Glad it worked and hopefully any of this wall of text can be helpful to anyone! <3