Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Why do we use braces in swift? what is the point of it?
var age=Int.random(in: 1...50)
print(age)
if age>=12 {
print("adult")
} else { print ("child") }
From Mastering Swift 4 - Fourth Edition by Jon Hoffman
In Swift, unlike most other languages, the curly bracket is required after conditional or loop statements. This is one of the safety features that are built into Swift. Arguably, there have been numerous security bugs that may have been prevented if the developer would have used curly braces.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Do the following sets of characters have a meaning? Thank you
+++++++++[ >+++++++++<]>+ ++.<++++[ >++++<]>++++.+.<+++[ ->+++<]>+.<+++[ >---<]>. <+++[ >+++<]>+.
If you look closer a little bit your BrainFck code, you will notice that doing:
+++++ ++++[ >+++ +++++ +<]
located at your first loop, is the same as:
+[><]
or:
+[]
or even:
-[><]
Only a little more confusing..
This is not C++ or python.
This is Brainf*ck.
The first loop looks suspect though :)
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm learning swift, but i'm not a native english speaker and just want to ask what does 'let' mean? I know its a constant but then why it's not 'cons'?
Is 'let' an abbrevation of some word?
I won't die without knowing it, i'm just curious ;)
Thanks.
There are other languages where let is used as a keyword before a variable declaration, such as BASIC and LISP (or Scheme), and I presume it was taken from there. It's not an abbreviation; it's the normal English word "let", used to introduce a command, as in "Let there be light;" in mathematics it is common to announce a symbol this way, as in "Let x be the unknown number of years we are trying to calculate."
To answer your question a little more fully, though: in my view, there is nothing about this word that makes it particularly suitable for constants. They seems to have made an arbitrary choice. var makes sense for a "variable" that can vary (get it?), so now they just needed another word, and they picked let. Personally, I think const would have been better.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Can some one tell me the regular expression for below file :
Input string
Exp :
com.skype.raider
com.instagram.android
com.android.phone
com.android.gallery
com.android.launcher
com.Zeus.webbrowser
Desired Strings(o/p)
com.android.phone
com.android.gallery
com.android.launcher
I tried like : $line =~ /com.android.*/ but its not working the way i wanted to be :(
I assume you're looking for a regular expression to match anything that begins with com.android.
If that is the case, try something like this:
com\.android\..*
Tested using RegexPlanet
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I want to write some notes in the draft of a LaTeX document, and at a later point I want to compile the document without them. I saw someone doing something like the following (but I forgot what he did). Write notes as {\scriptsize some_text}, and in the end replace all {\scriptsize ...} with {} with a \newcommand. But I can't figure out how to write a \newcommand to replace all {\scriptsize some_text} occurrences by empty strings. I can then just comment or uncomment the \newcommand line.
Declare in the beginning of your file
\somevariabletrue
%\somevariablefalse
so you can quickly uncomment one and comment second, and in the later part of your code:
\ifsomevariable
...
\else
...
\fi
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
For my iPhone app in objective-c is it possible, and if so how can I make a variable inside a variable?
For example, I have one named Var1 and then I can combine it with Var2. Lets say Var2 is a number, so it displays Var1 like Var11, the second one being Var2. Make sense? Anyway if Im not making sense, could you let me know how a variable in a variable can be done, and used? Thanks.
Are you talking about arrays? Use Arrays.