if-statement

My if statement doesn't work

时光毁灭记忆、已成空白 提交于 2019-12-24 16:42:37
问题 I am writing a service application in Android . In this application, I am receiving commands from Main activity using onStartCommand event. The IF block is checking a variable. As you can see in the picture(Debug mode), the value is "start" but the IF statement doesn't work and will redirect to Else . why? 回答1: try with .equals will help you... String is not Primary Data type in java Always use .equals() when you have Object and String is Object == is only for primitive data type and == in

My if statement doesn't work

血红的双手。 提交于 2019-12-24 16:42:24
问题 I am writing a service application in Android . In this application, I am receiving commands from Main activity using onStartCommand event. The IF block is checking a variable. As you can see in the picture(Debug mode), the value is "start" but the IF statement doesn't work and will redirect to Else . why? 回答1: try with .equals will help you... String is not Primary Data type in java Always use .equals() when you have Object and String is Object == is only for primitive data type and == in

if statement not working ends program immediately

陌路散爱 提交于 2019-12-24 16:26:16
问题 Im making a weather man code but when i ask for the temperature it ends the program. here's the code. #include <stdio.h> int main(void) { int a; int b; int c; int d; printf("What Is Your Name?\n"); scanf("%s",&b); printf("Hi %s\n", &b); sleep(1); printf("Im Your Own Weather Man\n"); sleep(1); printf("Isn't That Great!\n"); sleep(1); printf("Please Type A Number In\n"); sleep(1); scanf("%d",&a); //checking out the number you wrote if(a<3) { printf("Its A Beatiful Day\n"); printf("%c\n",2); }

Else If and Do while does not work as intended

家住魔仙堡 提交于 2019-12-24 16:09:28
问题 EDIT: Recent happenings of me compiling a program I know could not compile lead me to believe I am simultaneously having an issue with my compiler. No doubt due to my running it in WINE on mac as opposed to a native application. Thank you for your responses. I will properly test out all responses and make all changes when I have fixed said error with compiler or I have moved computers to one with a working one. I am relatively new to programming and also this website so please bear with me. I

vba replace nested if statement

江枫思渺然 提交于 2019-12-24 15:47:01
问题 Is there a way to make this more efficient? I find it a bit ugly. I want to verity if there is a next "deck", if so, execute some for it, until deck8 here is my code: If deckNum > 0 Then 'Execute code for deck 1 If deckNum > 1 Then 'Execute code for deck 2 If deckNum > 2 Then 'Execute code for deck 3 If deckNum > 3 Then 'Execute code for deck 4 If deckNum > 4 Then 'Execute code for deck 5 If deckNum > 5 Then 'Execute code for deck 6 If deckNum > 6 Then 'Execute code for deck 7 If deckNum > 7

else statement does not return to loop

筅森魡賤 提交于 2019-12-24 15:25:56
问题 I have a code that opens a file, calculates the median value and writes that value to a separate file. Some of the files maybe empty so I wrote the following loop to check it the file is empty and if so skip it, increment the count and go back to the loop. It does what is expected for the first empty file it finds ,but not the second. The loop is below t = 15.2 while t>=11.4: if os.stat(r'C:\Users\Khary\Documents\bin%.2f.txt'%t ).st_size > 0: print("All good") F= r'C:\Users\Documents\bin%.2f

Having issues with generating 1 to 300 numbers between 1 to 100 and placing each number in a String

醉酒当歌 提交于 2019-12-24 15:25:08
问题 I'm trying to accept a number in the range 1 to 300 from the user, then generate the amount of random numbers that was inputted. Then if the numbers generated are in the range 1 to 10, I add an asterisk to a String, then I do the same for 11 to 20 etc. all the way up to 100. Although I keep getting errors saying "; expected" in the results portion of my code. The output I'm trying to achieve is: 1 to 10 **************** 11 to 20 ****** 21 to 30 *************** 31 to 40 ******************** 41

How can I put a condition on the way of join?

断了今生、忘了曾经 提交于 2019-12-24 14:56:42
问题 I have this table structure: // QandA +----+---------------------+----------------------------------------+------+---------+ | Id | title | content | type | related | +----+---------------------+----------------------------------------+------+---------+ | 1 | title of question 1 | content of question1 | 0 | 1 | | 2 | | content of first answer for question1 | 1 | 1 | | 3 | title of question 2 | content of question2 | 0 | 3 | | 4 | | content of second answer for question1 | 1 | 1 | | 5 | |

Comparing creation dates of files in VBScript

谁说胖子不能爱 提交于 2019-12-24 14:29:46
问题 This may be very obvious to someone out there but I'm having a lot of trouble trying to solve a bug in VBScript. Within the script, I am running through a bunch of .zip files in a directory and processing ones whose creation date is within a specified range. For instance, if the user enters two arguments 9/3/2014 and 9/5/2014, I only want to process zip files within that date range. Here is the if statement I am using: If Mid(file.NAME,len(file.NAME)-3,4) = ".zip" AND FormatDateTime(file

Excel user defined function if cell is highlighted then

房东的猫 提交于 2019-12-24 13:58:23
问题 I have created a user defined function to determine whether cells are highlighted a particular color, and it works in some situations, but not the one I need; Basically it works when that cell is permanently highlighted that color but I am basing it on conditional formatting and the function doesn't work if the cell is that color due to conditional formatting. Public Function Active(Rng As Range) As Boolean If Rng.Interior.Color = RGB(217, 151, 149) _ Then Active = True End Function Any help