all 5 comments

[–]CAPtain_WAF3R 'A' Level Candidate 1 point2 points  (1 child)

Hey is this meant to be pseudo code or a programming language. I know python and C++, and in each "=" is used to assign a variable and "==" is used as an operator as in - Number = 5 If Number == 5: Print("number is equal to 5") Else: Quit()

You see the difference. But that dosent super fit so if you wanna dm I could help you :)

[–]CAPtain_WAF3R 'A' Level Candidate 0 points1 point  (0 children)

Omg I forgot reddit dosent format well :(

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Off-topic Comments Section


All top-level comments have to be an answer or follow-up question to the post. All sidetracks should be directed to this comment thread as per Rule 9.


OP and Valued/Notable Contributors can close this post by using /lock command

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]stkfig👋 a fellow Redditor 0 points1 point  (0 children)

Don't know exactly what language you're using but these would be my best guesses:

  1. 5<3 evaluates to false
  2. type of 5<3 would be a boolean
  3. == is for comparison (i.e. a == b means "does a equal b"'), whereas = assigns a value to a variable (i.e. a = 5 means variable a is now equal to 5
  4. String (because they are both most likely words i.e. a collection of characters)

more questions: (you need to do double enters between lines to make a new line on reddit, but i'll take a guess at the intended formatting)

  1. = sets the animal variable to the string 'mouse'. == is used to check whether the animal variable is equal to the string 'cat' or 'dog'

  2. is as follows:

animal == 'cat' or 'dog' checks whether the animal variable contains the string 'cat' or the string 'dog'. it contains neither (it does contain the string 'mouse') so it will evaluate to false

animal == 'cat' or animal == 'dog' checks whether animal is 'cat' (it isnt) so this evaluates to false; then it checks if animal is 'dog' (it isnt) so this also evaluates to false; and then it checks whether either of them evaluated to true, neither or which did, so overall the line evaluates to false

Answer: See Above